Home > Backend Development > PHP Tutorial > PHP语法错误,折腾一天了,求高手帮忙。

PHP语法错误,折腾一天了,求高手帮忙。

WBOY
Release: 2016-06-23 13:41:29
Original
838 people have browsed it

我写一个无限级分类下拉功能,到下面这个代码老是报错,折腾一天了,求高手看看。

           $str_select.= "<option value=" .$row['classid'] if ($classid == $row['classid']){ echo "selected"}.">" .str_repeat( "-" ,$depth) . $row['classname']."</option>"; //字符串构建
Copy after login


错误提示:Parse error: syntax error, unexpected T_IF


回复讨论(解决方案)

求高手帮忙11!

$str_select .= ""; //字符串构建

参考楼上,话说你分开写好了,容易知道错哪

建?不要?在同一行。

如果一定要可以???

$str_select.= "<option value='" .$row['classid']."' ".($classid==$row['classid']? "selected" : "").">" .str_repeat( "-" ,$depth) . $row['classname']."</option>"; //字符串构建
Copy after login

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template