代码:
<?php
$con=mysqli_connect("mysql17.000webhost.com","login","pwd","db");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysql_connect_error();
}
$filter = mysqli_query($con,"SELECT * FROM bad_words");
$content = mysqli_fetch_array( $filter );
$old_word = $_POST("input");
$old_word = str_ireplace($content['word'], '[foul]', $old_word);
$filtered_word = $old_word;
Print($filtered_word);
mysqli_close($con);
?>
错误讯息:
致命错误:函数名称必须是第13行/home/a7593238/public_html/bad_filter.php中的字符串
请帮忙。
答案 0 :(得分:8)
您正在像函数一样调用超全局数组$_POST
。它是一个数组变量,您需要使用方括号访问它们。
喜欢这个。
$old_word = $_POST["input"];
答案 1 :(得分:2)
替换
$old_word = $_POST("input");
带
$old_word = $_POST["input"];