我在分配给数据数组的<p>
标记内部有一个url。我输入了以下代码:
$link = home_url();
'side_by_side_content' => [
"img" => [
"src" => "/wp-content/uploads/2018/02/hello.jpg",
"alt" => "Hello"
],
"title" => "Hello World",
"text" => "<p>Sorry! It appears the page you're looking for cannot be found. You can continue on to <a href=\'<?php echo $link; ?>\'>test.com Homepage</a></p>"
]
因此,当我运行此代码时,网址会以test.com /<?php echo $link; ?>
的形式显示。它需要出现在主页上,或者只是test.com是否有我在这里缺少的内容?
答案 0 :(得分:2)
你在php中声明了php。
只需这样做:
'<p>Sorry! It appears the page you\'re looking for cannot be found. You can continue on to <a href="'.$link.'">test.com Homepage</a></p>'
答案 1 :(得分:0)
标签设置不正确,只需使用类似
HREF =&#34;&#39; $链路&#39;&#34;&GT; test.com
答案 2 :(得分:0)
我实际上通过这样做解决了这个问题:
href=".'/'."
以及href='$link'
感谢所有帮助人员。