One, Dede run PHP code
Example 1:
{dede:name runphp= ' yes '}
$str = "Hello";
@me = $str;
@me. = "World";
{/dede:name}
Result: Hello World
Description: "Name" is any defined name, @me represents the current value, which is the value to output the last @me.
For example 2
{Dede:field runphp= ' yes '}
$STR = "World";
$DedeMeValue = "Hello";
$DedeMeValue. = $str;
{/dede:field}
Result: Hello World
Note: If you directly introduce PHP and want to get the running value, you must use the $DedeMeValue to indicate the value of the final return after running this PHP (and therefore cannot be mixed with HTML)
For example 3
{dede:list perpage= ' 10 '}
[Field:id runphp= "yes"]
$dsql = new Dedesql (false);
$a = "Select A.address from Dede_addonarticle as a where a.aid= @me";
$arcRow = $dsql->getone ($a);
@me = '. $arcRow [address].
[/field:id]
{/dede:list}
Second, the reference PHP file
If you want to use PHP in the Include file, add source= ' value '
{dede:include runphp= ' yes ' source= ' value ' file= '/}
Third, Dede running the MySQL statement
For example 1
{dede:sql sql= ' select COUNT (*) as Nums from dede_addonarticle}
[Field:name = "nums"/]
{/dede:sql}
The output is the value of the Nums field of the Dede_addonarticle table, the query out a few to output several times
For example 2
{dede:sql sql= "select * from Dede_archives WHERE writer=~writer~"}
[Field:id/]
{/dede:sql}
Description: ~writer~ is a variable. For example, in the Content page template, the call is a table, a table has the field writer=xc, then the above statement in this content page templates is equivalent to select * from dede_archives where writer= ' xc ', [Field:id/] Is the ID field in the database dede_archives