繁体   English   中英

将字符串与php中的变量连接

[英]concatenate string with variable in php

我将变量声明为$Catalogurl = "test"; 现在,我想在此行中连接到“ cataloglink”,以便“ link”将为“ test” +“ cataloglink”中的变量。 我该怎么做?

'link' => $node->getElementsByTagName('cataloglink')->item(0)->nodeValue,

谢谢

'link' => $Catalogurl . $node->getElementsByTagName('cataloglink')->item(0)->nodeValue,

有关更多信息,请参见http://www.php.net/manual/en/language.operators.string.php

尝试使用concat运算符“。” 使用它的方法只是将要连接的两个变量都放在它的两边。 所以:

$hello = "Hello"." World";

如果您有时间,我建议您看一下文档,里面有很多整洁的东西。 http://www.php.net/manual/en

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM