Home > Article > Backend Development > How to define global variables like dedecms?
As shown below, where is the $arc object defined?
<code>{dede:php}$GLOBALS['变量名']=$arc->Fields['fieldname']{/dede:php}</code>
The application scenario is to determine the output when a field is empty, in which other fields need to be called:
{dede:field.Field name runphp='yes'}
if(@me =='')
{
@me= 'Output result when the value is empty';
}
else
{
@me=@me;
}
{/dede:field.field name}
As shown below, where is the $arc object defined?
<code>{dede:php}$GLOBALS['变量名']=$arc->Fields['fieldname']{/dede:php}</code>
The application scenario is to determine the output when a certain field is empty, in which other fields need to be called:
{dede:field.Field name runphp='yes'}
if(@me =='')
{
@me= 'Output result when the value is empty';
}
else
{
@me=@me;
}
{/dede:field.field name}