当前位置:网站首页>织梦模板加入php代码
织梦模板加入php代码
2022-08-01 20:46:00 【网站建设影子】
织梦模板页面内嵌入php
例
{dede:name runphp='yes'}
$str = "hello";
@me = $str;
@me .= "world"
{/dede:name}最终输出结果为hello world
其实"name"为任意定义的名字,"@me="后面的值是最终用于输出的值,我就拿它代替echo来用(如果直接用echo,模板生成的时候报错,这就是有所限制的地方,唉)。
引用php文件
如果你想在include的文件中使用PHP,则加上 source='value'
{dede:include runphp='yes' source='value' file=''/}PHP编写的规范为
一、PHP编码中不需要再加<??>符号;
二、如果想处理当前标记的值(上面第一种情况),使用 @me 表示当前的值;
三、如果直接引入PHP并要获得运行后的值,必须用 $DedeMeValue 表示运行这个PHP后最终返回的值(因此不能用HTML混合的写法)。
例:
{dede:name runphp='yes'}
$str = "hello";
@me = $str;
@me .= "world"
{/dede:name}边栏推荐
猜你喜欢

Postman 批量测试接口详细教程

【Kaggle】House Prices

Zheng Xiangling, Chairman of Tide Pharmaceuticals, won the "2022 Outstanding Influential Entrepreneur Award" Tide Pharmaceuticals won the "Corporate Social Responsibility Model Award"

vant实现Select效果--单选和多选

通配符 SSL/TLS 证书

4.1 配置Mysql与注册登录模块

Remove 360's detection and modification of the default browser

SIPp 安装及使用

Wildcard SSL/TLS certificate

仿牛客论坛项目
随机推荐
WhatsApp群发实战分享——WhatsApp Business API账号
【个人作品】无线网络图传模块
线上问题排查常用命令,总结太全了,建议收藏!!
任务调度线程池-应用定时任务
【Kaggle】Classify Leaves
1374. 生成每种字符都是奇数个的字符串 : 简单构造模拟题
2022年秋招,软件测试开发最全面试攻略,吃透16个技术栈
Which websites are commonly used for patent searches?
Get started quickly with MongoDB
98. Embedded controller EC actual combat EC development board development completed
】 【 nn. The Parameter () to generate and why do you want to initialize
互联网大厂研发流程
【节能学院】推进农业水价综合改革的意见解读
Application of Acrel-5010 online monitoring system for key energy consumption unit energy consumption in Hunan Sanli Group
通俗解释:什么是临床预测模型
string
【个人作品】记之-串口日志记录工具
StringTable Detailed String Pool Performance Tuning String Concatenation
"No title"
Godaddy domain name resolution is slow and how to use DNSPod resolution to solve it