「Php/php8」の版間の差分
提供: 初心者エンジニアの簡易メモ
(→smartyのテンプレの使ってない変数の警告) |
|||
| 行15: | 行15: | ||
{{if isset($request.key)}} | {{if isset($request.key)}} | ||
</pre> | </pre> | ||
| + | |||
| + | |||
| + | ==Staticがついてないエラー== | ||
| + | エラー詳細 | ||
| + | Non-static method SessionModel::getInstance() cannot be called statically | ||
| + | 対応前 | ||
| + | public function getInstance() | ||
| + | 対応後 | ||
| + | public static function getInstance() | ||
2026年4月4日 (土) 01:19時点における版
クラス名の関数をconstructとして完全に使えなくなった
php7までは非推奨で、php8からは、完全に使えない。 __construnct()にする。
smartyのテンプレの使ってない変数の警告対応
エラー詳細
Warning: Undefined array key "key"
修正前
{{if $request.key}}
修正後
{{if isset($request.key)}}
Staticがついてないエラー
エラー詳細
Non-static method SessionModel::getInstance() cannot be called statically
対応前
public function getInstance()
対応後
public static function getInstance()
