Home  >  Article  >  php教程  >  dedecms {dede:php}标签用法介绍,dedecmsdede

dedecms {dede:php}标签用法介绍,dedecmsdede

WBOY
WBOYOriginal
2016-06-13 09:21:42852browse

dedecms {dede:php}标签用法介绍,dedecmsdede

最简单的输入如

代码如下 复制代码
{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] => 问答
)

是不是很简单啊,有需要学习的朋友可以参考一下本文章哈。
from:http://www.111cn.net/wy/CMS/42052.htm

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn