Parse error: syntax error, unexpected ',', expecting variable (T_VARIABLE)
Parse error: syntax error, unexpected ',', expecting variable (T_VARIABLE)
我在定义函数和 error_reporting(E_ALL);
中遇到错误
有错误Parse error: syntax error, unexpected ',', expecting variable (T_VARIABLE) in C:\xampp\htdocs\bs4\func.php on line 4
这是我的代码
<?php
error_reporting(E_ALL);
require_once "condb.php";
function noproblem(time,suggest,phone,eat,problem){ // Here is line 4
$sql="insert into data(time,suggest,phone,eat,problem) values(?,?,?,?,?)";
$stmt=$cn->prepare($sql);
$stmt->bindParam("1",time);
$stmt->bindParam("2",suggest);
$stmt->bindParam("3",phone);
$stmt->bindParam("4",eat);
$stmt->bindParam("5",problem);
try {
$stmt->execute();
echo "ok!";
} catch (Exception $e) {
echo $e->getTraceAsString();
}
}
?>
在 PHP 中,变量必须以 $:
开头
function noproblem($time,$suggest,$phone,$eat,$problem){
示例中的所有其他变量也是如此。
变量以“$”符号开头。
如果您确定所有变量都以“$”符号开头,则您的 PHP 版本可能是原因。
我在定义函数和 error_reporting(E_ALL);
有错误Parse error: syntax error, unexpected ',', expecting variable (T_VARIABLE) in C:\xampp\htdocs\bs4\func.php on line 4
这是我的代码
<?php
error_reporting(E_ALL);
require_once "condb.php";
function noproblem(time,suggest,phone,eat,problem){ // Here is line 4
$sql="insert into data(time,suggest,phone,eat,problem) values(?,?,?,?,?)";
$stmt=$cn->prepare($sql);
$stmt->bindParam("1",time);
$stmt->bindParam("2",suggest);
$stmt->bindParam("3",phone);
$stmt->bindParam("4",eat);
$stmt->bindParam("5",problem);
try {
$stmt->execute();
echo "ok!";
} catch (Exception $e) {
echo $e->getTraceAsString();
}
}
?>
在 PHP 中,变量必须以 $:
开头function noproblem($time,$suggest,$phone,$eat,$problem){
示例中的所有其他变量也是如此。
变量以“$”符号开头。
如果您确定所有变量都以“$”符号开头,则您的 PHP 版本可能是原因。