thinkphp problem has been a long, still do not know, you God help to see it
Code in the controller:
Public Function Testt () {
$title = "Practice book";
$content = '
'. $_get[' name '];
$this->assign (' title ', $title);
$User = M (' name ');
$list = $User->select ();
$this->assign (' list ', $list);
$this->assign ("title", "Smarty Test");
$this->display ();
}
Code in the template:
{$title}
{$vo. Age} {$vo. Name}
Important to remove the foreach part is normal, otherwise it will appear like this
Syntax error, unexpected ') ', expecting t_variable or ' $ ' D:\AppServ\www\App\admin\Runtime\Cache\ 6e178638460c8ba2282739c247c2ce14.php Line 10th.
The code in the cache file is:
$): Echo ($vo ["age"]); Echo ($vo ["name"]);?>
It seems a long time no clue, how to do ah?
thinkphp foreach
Share to:
------Solution--------------------
The list is empty, you're checking it yourself.
------Solution--------------------
Public Function _foreach ($attr, $content) {
Static $_iterateparsecache = Array ();
Returns the value of a variable directly if it has already been resolved
$cacheIterateId = MD5 ($attr. $content);
if (Isset ($_iterateparsecache[$cacheIterateId]))
return $_iterateparsecache[$cacheIterateId];
$tag = $this->parsexmlattr ($attr, ' foreach ');
$name = $tag [' name '];
$item = $tag [' Item '];
$key =