include php file in echo html code

落爺英雄遲暮 提交于 2019-12-26 19:54:06

问题


I cant get this syntax to work, already tried modifying it many time.

    <?php
echo 
"<a href='".include 'go/randomlink.php'."'>".$item['stockid']."</a>";
?>

回答1:


For this to work, your other php file must simply echo some string.

randomlink.php:

<?php
echo "What came first the chicken or the egg?";
?>

index.php:

echo "<a href='";
include('go/randomlink.php');
echo "'>" . $item['stockid'] . "</a>";

hope this helps you.



来源:https://stackoverflow.com/questions/35811857/include-php-file-in-echo-html-code

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!