ホームページ >バックエンド開発 >PHPチュートリアル >调用Eloquent Orm save的时候出现问题

调用Eloquent Orm save的时候出现问题

WBOY
WBOYオリジナル
2016-06-06 20:10:022287ブラウズ

错误提示如下:Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'updated_at' in 'field list'' in /home/parallels/Desktop/www/vendor/illuminate/database/Illuminate/Database/Connection.php:369 Stack trace: #0 /home/parallels/Desktop/www/vendor/illuminate/database/Illuminate/Database/Connection.php(369): PDO->prepare('insert into bl...') #1 /home/parallels/Desktop/www/vendor/illuminate/database/Illuminate/Database/Connection.php(617): Illuminate\Database\Connection->Illuminate\Database\{closure}(Object(Illuminate\Database\MySqlConnection), 'insert into bl...', Array) #2 /home/parallels/Desktop/www/vendor/illuminate/database/Illuminate/Database/Connection.php(581): IlluminateDatabaseConnection->runQueryCallback('insert into bl...', Array, Object(Closure)) #3 /home/parallels/Desktop/www/vendor/illuminate/database/Illuminate/Database/Connection.php(370): Illuminate\Database\Connection->run('insert into bl...', Array, Object(Closure)) #4 /home/parallels/Desktop/www/vendor in /home/parallels/Desktop/www/vendor/illuminate/database/Illuminate/Database/Connection.php on line 625

回复内容:

错误提示如下:Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'updated_at' in 'field list'' in /home/parallels/Desktop/www/vendor/illuminate/database/Illuminate/Database/Connection.php:369 Stack trace: #0 /home/parallels/Desktop/www/vendor/illuminate/database/Illuminate/Database/Connection.php(369): PDO->prepare('insert into bl...') #1 /home/parallels/Desktop/www/vendor/illuminate/database/Illuminate/Database/Connection.php(617): Illuminate\Database\Connection->Illuminate\Database\{closure}(Object(Illuminate\Database\MySqlConnection), 'insert into bl...', Array) #2 /home/parallels/Desktop/www/vendor/illuminate/database/Illuminate/Database/Connection.php(581): IlluminateDatabaseConnection->runQueryCallback('insert into bl...', Array, Object(Closure)) #3 /home/parallels/Desktop/www/vendor/illuminate/database/Illuminate/Database/Connection.php(370): Illuminate\Database\Connection->run('insert into bl...', Array, Object(Closure)) #4 /home/parallels/Desktop/www/vendor in /home/parallels/Desktop/www/vendor/illuminate/database/Illuminate/Database/Connection.php on line 625

初步看,是你的表结构中少了字段 updated_at,可以是datetime 或者timestamp 类型

orm好调试吗?

缺少列了。。表最好不要手动建啦。。可以用迁移工具来建

声明:
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。