dedecms中使用php语句指南,dedecmsphp语句指南
在DEDECMS中,使用php语句的话,本身是有{dede:php}标签可以使用的,最简单的输入如
复制代码 代码如下:
{dede:php}
$numA = 1;
$numB = 2;
echo $numA + $numB;
{/dede:php}
从上面语句可以看出dede:php标签可以名符其实的让在php中一样的用法,上面语句在php写法如下
复制代码 代码如下:
$numA=1;
$numB=2;
echo $numA+$numB;
?>
是不是看上去很像啊,再看一个再有if else 条件判断的
复制代码 代码如下:
[field:global runphp='yes' name=autoindex]
$a="";
$b="";
$c="";
if (@me > 3) @me = $c.@me.$b;
else @me = $a.@me.$b;
[/field:global]
这个在php中写法我就不写了,下面我们要看dede php标签结合起来sql标签使用。
结合SQL查询输出单条内容
复制代码 代码如下:
{dede:php}
$row = $dsql->GetOne('select id,typename from dede_arctype where id=2');
print_r($row);
{/dede:php}
这个输出的内容是
复制代码 代码如下:
Array
(
[id] => 2
[typename] => 问答
)
是不是很简单啊,有需要学习的朋友可以参考一下本文章哈。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

SublimeText3 Chinese version
Chinese version, very easy to use

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.