所以我需要创建一个可变的子域来添加到域的末尾,但它不会识别变量.在这个例子中,它只会去google.com.有谁知道这样做的正确方法?
<html>
<?php $subdom="news";?>
<a href="http://www.google.com/"<?php echo $subdom;?>>google</a>
</html>
Run Code Online (Sandbox Code Playgroud)
您需要在结束引号之前添加域以将其附加到href变量,而不是仅将其添加到a标记中.
<a href="http://www.google.com/<?php echo $subdom;?>">google</a>
Run Code Online (Sandbox Code Playgroud)