解析错误:语法错误,意外的'?'错误
问题描述:
picture of code我有这样的代码:解析错误:语法错误,意外的'?'错误
<?php if(isset($_GET["update"])){
$id = $_GET["id"] ?? null;
$where = array("id"=>$id);
$row = $obj->select_record("medicines",$where);
?>
我得到这个:
解析错误: '?' 语法错误,意外在C:\瓦帕\ WWW \上线新建文件夹\的index.php 42
是否有任何替代上述代码?
答
你应该使用:
$id = $_GET['id']?$_GET['id']:null;
您正在使用什么版本的PHP?我猜测 chris85
看起来你已经写了一些PHP7代码,并且你没有使用PHP7 .. –