Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/274.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Smarty assign变量-返回零_Php_Variables_Smarty - Fatal编程技术网

Php Smarty assign变量-返回零

Php Smarty assign变量-返回零,php,variables,smarty,Php,Variables,Smarty,我有个问题。。。我试图在Smarty中简单地为变量赋值,但它总是返回0。知道为什么吗 {if (strstr($pid, 'XXX') == true) || ($did == 256)} ......Step 1 reached...... {if (strstr($pid, 'MTG') == true) || ($key_name == 'mtgfc')} ......step 2 reached....... {assign var="css-ta

我有个问题。。。我试图在Smarty中简单地为变量赋值,但它总是返回0。知道为什么吗

{if (strstr($pid, 'XXX') == true) || ($did == 256)}
......Step 1 reached......
    {if (strstr($pid, 'MTG') == true) || ($key_name == 'mtgfc')}
        ......step 2 reached.......
        {assign var="css-tag" value="mtg"}
        <p>css-tag = {$css-tag}</p>
    {/if}
{/if}

为什么不给变量赋值?

就像在php中一样,不能在变量名中使用减号。改为使用下划线:

{assign var="css_tag" value="mtg"}
{assign var="css_tag" value="mtg"}