这是我的文章。 PHP代码包含在{source}标记中,而sourcerer在文章中神奇地运行PHP。我以前成功使用过Sourcerer;但现在却抛出了一些奇怪的错误。
{source}
<?php
if (isset($_POST['submit'])) {
$connect = mysql_connect("host","user","pass");
mysql_select_db("<redacted>", $connect);
$term = $_POST['userid'];
$getUserid = mysql_query("SELECT itemid, first, last FROM tenants where CONCAT(first, last) LIKE '%$term%'");
$result = mysql_fetch_array($getUserId);
?>
{/source}
<table>
<tr>
<td align="center">itemID</td>
<td align="center">First</td>
<td align="left">Last</td>
</tr>
{source}
<?php
while ($data = mysql_fetch_row($result)) {
?>
{/source}
<tr>
<td align="center" valign="middle">
{source} <?php echo $data['id']; ?> {/source}
</td>
<td align="center" valign="middle">
{source} <?php echo $data['first']; ?>{/source}
</td>
<td align="left" valign="middle">
{source} <?php echo $data['last']; ?>{/source}
</td>
</tr>
</table>
{source}
<?php
}
}
?>
{/source}
Enter a Search Term: <input name="submit" type="submit" value="Register Now" style="width: 130px; height: 30px;" />
访问文章时的错误是:
[Mon Nov 16 15:03:41 2015] [warn] [client 74.84.255.79] mod_fcgid: stderr: PHP Parse error: syntax error, unexpected end of file in /mnt/data/vhosts/<redacted>/plugins/system/sourcerer/helper.php(607) : runtime-created function on line 17, referer: http://host/
[Mon Nov 16 15:03:41 2015] [warn] [client 74.84.255.79] mod_fcgid: stderr: PHP Fatal error: Function name must be a string in /mnt/data/vhosts/<redacted>/plugins/system/sourcerer/helper.php on line 612, referer: http://host/
在helper.php中,这是第607行:
$temp_PHP_func = create_function('&$src_vars, &$article, &$Itemid, &$mainframe, &$app, &$document, &$doc, &$database, &$db, &$user', $src_script);
这是612:
$src_new_vars = $temp_PHP_func($src_vars, $article, $Itemid, $mainframe, $app, $document, $doc, $database, $db, $user);
我会感激任何帮助。我在这里完全失去了。