[英]Require_once not working in PHP script
I am making a wordpress plugin and I am having a little issue with this paragraph of code. 我正在制作一个wordpress插件,但这段代码有一个小问题。 For some reason
由于某些原因
echo "<table style='border:solid 1px #000000;'>
<tr>
<td style='border:solid 1px #000000;'>Total Submission Sites</td>
<td style='border:solid 1px #000000;'>Server Status</td>
<td style='border:solid 1px #000000;'>Plugin Version</td>
<td style='border:solid 1px #000000;'>Latest Update</td>
</tr>
<tr>
<td style='border:solid 1px #000000;'>test</td>
<td style='border:solid 1px #000000;'>test</td>
<td style='border:solid 1px #000000;'>test</td>
<td style='border:solid 1px #000000;'> <?php require_once('http://wert.in/pluginfiles/files/v101/v101.php') ?></td>
</tr>
</table>";
Don't put the require into the echo, or it will just display the text and not parse the function. 不要将require放入echo中,否则它只显示文本而不解析函数。 You need to end the echo with a "; then the require, and then output again. Or you can use echo "something" . require(blah) . "end"; but I didn't use this for simplicities sake. Also, the require uses a local path/file not remote. This is the equivelent of trying to open a URL in Notepad on your computer, when its looking for something on your hard drive instead.
您需要在回声后面加上一个“;然后是require,然后再次输出。或者您可以使用echo” something“。require(blah)。” end“;但是为了简单起见,我没有使用它。此外, require使用本地路径/文件而不是远程文件,这等效于在硬盘上查找记事本时尝试在计算机上的记事本中打开URL。
// start the echo
echo "<table style='border:solid 1px #000000;'>
<tr>
<td style='border:solid 1px #000000;'>Total Submission Sites</td>
<td style='border:solid 1px #000000;'>Server Status</td>
<td style='border:solid 1px #000000;'>Plugin Version</td>
<td style='border:solid 1px #000000;'>Latest Update</td>
</tr>
<tr>
<td style='border:solid 1px #000000;'>test</td>
<td style='border:solid 1px #000000;'>test</td>
<td style='border:solid 1px #000000;'>test</td>
<td style='border:solid 1px #000000;'>";
// Still using php, dont need the opening tag.
require_once('http://wert.in/pluginfiles/files/v101/v101.php');
// Finish the echo
echo "</td>
</tr>
</table>";
why echo a whole string and not without and only <?php require_once( [.....] ); ?>
为什么回显一个完整的字符串,而不是只有
<?php require_once( [.....] ); ?>
<?php require_once( [.....] ); ?>
<table style='border:solid 1px #000000;'>
<tr>
<td style='border:solid 1px #000000;'>Total Submission Sites</td>
<td style='border:solid 1px #000000;'>Server Status</td>
<td style='border:solid 1px #000000;'>Plugin Version</td>
<td style='border:solid 1px #000000;'>Latest Update</td>
</tr>
<tr>
<td style='border:solid 1px #000000;'>test</td>
<td style='border:solid 1px #000000;'>test</td>
<td style='border:solid 1px #000000;'>test</td>
<td style='border:solid 1px #000000;'><?php require_once('./pluginfiles/files/v101/v101.php') ?></td>
</tr>
</table>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.