在echo PHP中使用echo

在echo PHP中使用echo,php,string,echo,Php,String,Echo,在PHP中,是否可以在已经包含文本的echo语句中使用site_url?例如,我可以改变: $data['following'] = 'You are not following ' . $name . ' <a href="http://raptor.kent.ac.uk/proj/co539/microblog/jlo21/index.php/user/follow/' . $name . ' ">Follow this user</a>'; $data['foll

在PHP中,是否可以在已经包含文本的echo语句中使用site_url?例如,我可以改变:

$data['following'] = 'You are not following ' . $name . ' <a href="http://raptor.kent.ac.uk/proj/co539/microblog/jlo21/index.php/user/follow/' . $name . ' ">Follow this user</a>';
$data['following']='youarnotfollowing'$名字;

$data['following']='youarnotfollowing'$名字。”
$data['following']='younotfollowing'$姓名;

否,但为什么不将返回值串联起来,而不是尝试
回显它呢

$data['following'] = 'You are not following ' . $name . ' <a href="' . site_url("user/follow") . '">Follow this user</a>
$data['following']='youarnotfollowing'$名字。”

您可以在字符串串联中使用函数调用:

$data['following'] = 'You are not following ' . $name . ' <a href="'. site_url("user/follow") . '">Follow this user</a>';
$data['following']='youarnotfollowing'$名字;

函数将返回字符串,它将像变量一样进行连接。

否。但是您可以像使用
$name
一样使用字符串连接。啊,我明白了,谢谢您的简单解释
$data['following'] = 'You are not following ' . $name . ' <a href="' . site_url("user/follow") . '">Follow this user</a>
$data['following'] = 'You are not following ' . $name . ' <a href="'. site_url("user/follow") . '">Follow this user</a>';