Catchable fatal error: Object of class DateTime could not be converted to string

エラーメッセージFatal error

エラー発生

 状態:-  閲覧数:3,156  投稿日:2016-04-21  更新日:2016-04-21  
Catchable fatal error: Object of class DateTime could not be converted to string in /★★.php on line ☆☆


エラー原因


DateTimeオブジェクトをそのまま出力しようとしたから


エラー対応


フォーマット後出力

遭遇例

 閲覧数:659 投稿日:2016-04-21 更新日:2016-04-21 

エラーメッセージ


Catchable fatal error: Object of class DateTime could not be converted to string in /demo/session/set_save_handler/new-pdo/5.4-less/2/customize/2/DbSessionHandler.php on line 166


エラー原因


DateTimeオブジェクトをそのまま出力しようとしたから
$date = new DateTime();
echo $date;



エラー対応


フォーマット後出力
$date = new DateTime();
echo $date->format('Y-m-d H:i:s');




Fatal error: require_once(): Failed opening required 'PEAR.php'

Fatal error: Uncaught Error: Call to a member function modify() on string

コメント投稿(ログインが必要)