Home > Backend Development > PHP Tutorial > php字符串拼接问题,大侠来看看

php字符串拼接问题,大侠来看看

WBOY
Release: 2016-06-23 14:14:29
Original
820 people have browsed it

$r=Db::singleSqlRow($s);$content="userName=$r['userName']";
Copy after login



$r是个数组,我这样下出错了,我知道把$r['userName']先定义一个变量就可以了,能否把$r['userName']自动当成变量处理


回复讨论(解决方案)

$content="userName={$r['userName']}";
对于易引起歧义的应当用{}括起来。

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