0

我想在另一个字符串中使用一个字符串,如下所示:

$url = " http://www.sample.com/index.php?nr= $string[0]";

我应该如何在最后插入这个字符串?

4

3 回答 3

0

作为您的问题的解决方案,请尝试执行以下代码片段。

您需要使用点运算符(。)在 php 中连接字符串

 $url = "http://www.sample.com/index.php?nr=".$string[0];
于 2013-04-21T12:40:55.847 回答
0
$url = "http://www.sample.com/index.php?nr={$string[0]}";

或者

$url = "http://www.sample.com/index.php?nr=" . $string[0];
于 2013-04-21T12:18:52.860 回答
0

就像你的例子

$url = "http://www.sample.com/index.php?nr=$string[0]";
于 2013-04-21T12:26:03.540 回答