当前位置:网站首页>织梦模板加入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}边栏推荐
- 人工智能可信安全与评测
- Custom command to get focus
- [Energy Conservation Institute] Application of Intelligent Control Device in High Voltage Switchgear
- Application of Acrel-5010 online monitoring system for key energy consumption unit energy consumption in Hunan Sanli Group
- myid file is missing
- Pytorch框架学习记录9——非线性激活
- [Energy Conservation Institute] Ankerui Food and Beverage Fume Monitoring Cloud Platform Helps Fight Air Pollution
- 基于FPGA的任意字节数(单字节、多字节)的串口(UART)发送(含源码工程)
- Go Atomic
- Interpretation of the meaning of each dimension of two-dimensional, three-dimensional, and four-dimensional matrices
猜你喜欢

进行交互或动画时如何选择Visibility, Display, and Opacity

LTE时域、频域资源

微服务负载均衡器Ribbon

idea插件generateAllSetMethod一键生成set/get方法以及bean对象转换

【nn.Parameter()】生成和为什么要初始化

MySQL Syntax Basics

What is the difference between a utility model patent and an invention patent?Understand in seconds!

【节能学院】智能操控装置在高压开关柜的应用

SIPp 安装及使用

Where should I prepare for the PMP exam in September?
随机推荐
Failed to re-init queues : Illegal queue capacity setting (abs-capacity=0.6) > (abs-maximum-capacity
【无标题】
Different operating with different locks, rounding
用户身份标识与账号体系实践
有点奇怪!访问目的网址,主机能容器却不行
Go Atomic
OSG Notes: Set DO_NOT_COMPUTE_NEAR_FAR to manually calculate far and near planes
数据库单字段存储多个标签(位移操作)
Imitation cattle forum project
Pytorch框架学校记录11——搭建小实战完整细节
Protocol Buffer 使用
Pytorch框架学习记录12——完整的模型训练套路
基于FPGA的任意字节数(单字节、多字节)的串口(UART)发送(含源码工程)
Pytorch框架学习记录10——线性层
宝塔搭建PESCMS-Ticket开源客服工单系统源码实测
【节能学院】安科瑞餐饮油烟监测云平台助力大气污染攻坚战
解除360对默认浏览器的检测与修改
Interview Blitz 70: What are sticky packs and half packs?How to deal with it?
仿牛客论坛项目
Based on FPGA in any number of bytes (single-byte or multibyte) serial port (UART) to send (including source engineering)