Get the App
SLTechnology News&Howtos  ›  Servers  › 

The method of using php statement in dedecms

Shulou Source: shulou.com Published: 2022-06-02 05:07:21 10月03日 Update

This article mainly introduces the method of using php sentence in dedecms, which is very detailed and has certain reference value. Friends who are interested must finish it!

In DEDECMS, if you use the php statement, you can use the {dede:php} tag. The simplest input is as follows:

{dede:php} $numA = 1; $numB = 2; echo $numA + $numB; {/ dede:php}

From the above statement, we can see that the dede:php tag can be used in the same way as in php. The above statement is written as follows in php:

Does it look like it? let's take a look at another one with if else conditions.

[field:global runphp='yes' name=autoindex] $a = ""; $b = ""; $c = ""; if (@ me > 3) @ me= $c.Secretme.roomb; else @ me= $a.cubme.roomb; [/ field:global]

I won't write this in php. Let's look at the combination of dede php tags and sql tags.

[related courses study: dedecms video tutorial]

Output a single piece of content with SQL query

{dede:php} $row = $dsql- > GetOne ('select id,typename from dede_arctype where id=2'); print_r ($row); {/ dede:php}

The content of this output is:

Array ([id] = > 2 [typename] = > Q & A) these are all the contents of the method of using php statements in dedecms. Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Tags: Sentences content labels methods writing output worthy of the name value interests guys partners tutorials more conditions knowledge articles industry videos courses course learning Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei NVidia Microsoft Shulou Information MariaDB