Home  >  Article  >  Backend Development  >  How to define global variables like dedecms?

How to define global variables like dedecms?

WBOY
WBOYOriginal
2016-08-04 09:20:171180browse

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}

Reply content:

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}

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn