包含文件内容php
我想将 php 文件中的内容包含到另一个 php 文件中。 (它位于 WordPress 网站中)
Include 或 require 不起作用,因为它只是包含文件,我需要内容本身。
file_get_contents 也不起作用,因为它只显示我的 php 代码而不执行它。
我必须使用什么功能?
I want to include the content from a php file into another php file. (It's in a wordpress site)
Include or require won't work because it's just including the file, I need the content itself.
file_get_contents is also not working because it just displays my php code and does not execute it.
what function do I have to use?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我也不完全理解你的问题,但我认为这可能对你有用:
$contents
现在将包含 PHP 脚本的“内容”(输出)。I don't fully understand your question either, but I think this might work for you:
$contents
will now contain the 'contents' (the output) of your PHP script.Pause。什么? 包含 将代码包含在文件中。我确信这就是你想要的。例如,请参阅下面的代码。
test.php
包含vars.php
并能够回显vars.php
中的变量Pause. What? Include includes the code in the file for you. I'm sure this is what you want. For instance, see the code below.
test.php
hasvars.php
included in it and its able to echo the variables fromvars.php