方法一:模板页面内嵌入PHP

 
 
{dede:name runphp='yes'}
$str = "hello";
@me = $str;
@me .= "world";
{/dede:name}

最终输出结果为 hello world

方法二:引用PHP文件

 
 
{dede:include runphp='yes' source='value' file='/path/to/your/php/file.php'}
  • PHP文件编写规范:
    • 不需要再加符号;
    • 处理当前标记的值使用 @me
    • 引入PHP并获取运行后的值使用 $DedeMeValue