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

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

WBOY
WBOYOriginal
2016-06-23 14:14:29802browse

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



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


回复讨论(解决方案)

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

Statement:
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