In DEDECMS, if you use the php statement, the {dede:php} tag can be used. The simplest input is:
{dede:php} $numA = 1; $numB = 2; echo $numA + $numB; {/dede:php}
From the above statement It can be seen that the dede:php tag can be used in the same way in PHP. The above statement is written as follows in PHP:
<? $numA=1; $numB=2; echo $numA+$numB; ?>
Doesn’t it look similar? Take another look and have an if else condition. I won’t write the judgment
[field:global runphp='yes' name=autoindex] $a="<SPAN class='num active'>"; $b="</SPAN>"; $c="<(www.jb51.net)SPAN class='num'>"; if (@me > 3) @me = $c.@me.$b; else @me = $a.@me.$b; [/field:global]
How to write this in php. Next we have to look at the use of dede php tags in combination with sql tags.
[Related course learning: dedecms video tutorial]
Combined with SQL query to output a single piece of content
{dede:php} $row = $dsql->GetOne('select id,typename from dede_arctype where id=2'); print_r($row); {/dede:php}
The output content is:
Array ( [id] => 2 [typename] => 问答 )
Isn’t it very simple? Friends who need to learn can refer to this article.
Recommended learning: dedecms usage tutorial
The above is the detailed content of How to use php statements in dedecms? (user's guidance). For more information, please follow other related articles on the PHP Chinese website!

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

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

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.

SublimeText3 Chinese version
Chinese version, very easy to use