热搜:NVER node 开发 php

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

2024-09-16 20:30:01
php字符串拼接问题,大侠来看看

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



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


回复讨论(解决方案)

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