当前位置:网站首页>织梦模板加入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 批量测试接口详细教程
- Custom command to get focus
- Interview assault 70: what is the glue bag and a bag?How to solve?
- 宝塔搭建PESCMS-Ticket开源客服工单系统源码实测
- Goroutine Leaks - The Forgotten Sender
- 【Social Media Marketing】How to know if your WhatsApp is blocked?
- 面试突击70:什么是粘包和半包?怎么解决?
- WhatsApp group sending actual combat sharing - WhatsApp Business API account
- Which websites are commonly used for patent searches?
- 多线程之生产者与消费者
猜你喜欢
Pytorch框架学习记录8——最大池化的使用
New graduate students, great experience in reading English literature, worthy of your collection
泰德制药董事长郑翔玲荣膺“2022卓越影响力企业家奖” 泰德制药荣获“企业社会责任典范奖”
【节能学院】推进农业水价综合改革的意见解读
【节能学院】智能操控装置在高压开关柜的应用
MySQL Syntax Basics
【多任务学习】Modeling Task Relationships in Multi-task Learning with Multi-gate Mixture-of-Experts KDD18
解除360对默认浏览器的检测与修改
【Social Media Marketing】How to know if your WhatsApp is blocked?
[Energy Conservation Institute] Application of Intelligent Control Device in High Voltage Switchgear
随机推荐
98. Embedded controller EC actual combat EC development board development completed
Use WeChat official account to send information to designated WeChat users
基于FPGA的任意字节数(单字节、多字节)的串口(UART)发送(含源码工程)
作为程序员你应该会的软件
KDD2022 | 自监督超图Transformer推荐系统
LTE time domain and frequency domain resources
Protocol Buffer 使用
useful website
LTE时域、频域资源
"No title"
Remove 360's detection and modification of the default browser
仿牛客论坛项目
WhatsApp群发实战分享——WhatsApp Business API账号
Simple test of the use of iptables
人工智能可信安全与评测
面试突击70:什么是粘包和半包?怎么解决?
Pytorch框架学习记录9——非线性激活
通俗解释:什么是临床预测模型
扣减库存方案
OSG Notes: Set DO_NOT_COMPUTE_NEAR_FAR to manually calculate far and near planes