下面的代码是产生这样的结果:http://localhost/my_website/ contact-us
结合变量和HTML PHP变量内
$base_url="http://localhost/my_website/";
echo $link= "$base_url contact-us ";
但我想获得这样的结果:http://localhost/my_website/contact-us
我也曾尝试下面的代码
$base_url="http://localhost/my_website/";
echo $link= "$base_url.contact-us ";
但结果是这样http://localhost/my_website/.contact-us
你能告诉我如何解决这个问题吗?
编辑
我很抱歉,我我以前不明确提到,我这里面临的具体问题。我认为上面的例子会帮助我的情况。其实我试图创建一个链接,我会在用户的电子邮件地址发送。
我的代码
$base_url="http://localhost/my_website/";
$random_hash="1";
echo $link="
<a href='$base_url account/confirm_registration/$random_hash' target='_blank'>$base_url account/confirm_registration/$random_hash</a>";
但它产生这样
http://localhost/my_website/ account/confirm_registration/1
你不知道如何使用连接字符'.':HTTP:// php.net/manual/en/language.operators.string.php – Stefan 2013-02-26 07:58:55
非常感谢:)我访问了链接并找到了解决方案。我正在使用{}这个{$ base_url}帐户/ ...,并且它工作的很完美。谢谢:) – 2013-02-26 08:09:16