84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
刚刚开学习php,在截取中文字符串时一直报错,救助大神们帮忙看看是什么原因,代码如下:
<a href="{:U('News/province?name='.($domain_info['title']|mb_substr=###,0,2,'utf-8'))}"><i>>>MORE</i></a>
光阴似箭催人老,日月如移越少年。
问题在于你后面的|mb_substr是thinkphp内置模板语言的语法,而U函数不会解析这种语法
所以正确方式是
<a href="{:U('News/province?name='.mb_substr($domain_info['title'],0,2,'utf-8')}"><i>>>MORE</i></a>
这样是解析不出来的,你忘了加<?php echo '';?>
问题在于你后面的|mb_substr是thinkphp内置模板语言的语法,而U函数不会解析这种语法
所以正确方式是
这样是解析不出来的,你忘了加<?php echo '';?>