1
このコードはログインフォームの一部です。このフィールドは空白でないことを確認します。私はこのコード行を使用していたとき、私は次のエラーを取得する:PHP 5ログイン "予期しない構文エラー、 '?' "使用している間??演算子
syntax error, unexpected '?'
if(is_blank($admin['username'])) {
$errors[] = "Username cannot be blank.";
} elseif (!has_length($admin['username'], array('min' => 8, 'max' => 255))) {
$errors[] = "Username must be between 8 and 255 characters.";
} elseif (!has_unique_username($admin['username'], $admin['id'] ?? 0)) {
$errors[] = "Username not allowed. Try another.";
}
は、私はPHP 5.5で働いているので、私はエラーを取得することを知っています。
ありがとうございました! PHP 5.5あなたは昔ながらの短い手を実行する必要があり??
null coalesce operator
(PHP 7以降)を持っていないので
(isset($admin['id']) ? $admin['id'] : 0)
:
誰かがこれを修正する方法を知っていますか? –