Smarty の assign() 関数はどのように定義されていますか?
この関数のコードとその原理を投稿できるのは誰ですか
-----解決策-------- ---- --------
smarty_internal_data.php
/**<br /> * assigns a Smarty variable<br /> *<br /> * @param array<br><font color='#FF8000'>------解决方案--------------------</font><br>string $tpl_var the template variable name(s)<br /> * @param mixed $value the value to assign<br /> * @param boolean $nocache if true any output of this variable will be not cached<br /> * @param boolean $scope the scope the variable will have (local,parent or root)<br /> */<br /> public function assign($tpl_var, $value = null, $nocache = false)<br /> {<br /> if (is_array($tpl_var)) {<br /> foreach ($tpl_var as $_key => $_val) {<br /> if ($_key != '') {<br /> if (isset($this->tpl_vars[$_key])) {<br /> $this->tpl_vars[$_key]->value = $_val;<br /> $this->tpl_vars[$_key]->nocache = $nocache;<br /> } else {<br /> $this->tpl_vars[$_key] = new Smarty_variable($_val, $nocache);<br /> }<br /> }<br /> }<br /> } else {<br /> if ($tpl_var != '') {<br /> if (isset($this->tpl_vars[$tpl_var])) {<br /> $this->tpl_vars[$tpl_var]->value = $value;<br /> $this->tpl_vars[$tpl_var]->nocache = $nocache;<br /> } else {<br /> $this->tpl_vars[$tpl_var] = new Smarty_variable($value, $nocache);<br /> }<br /> }<br /> }<br /> }<br />