PHP報錯:
strpos() expects parameter 1 to be string, integer given
出錯代碼
public static function showArticle($id)
{
ArticleModel::where('id', '=', $id)
->update(['is_show', 0]);
}
問題在于數組的格式寫錯了
->update(['is_show', 0]);
應該修改為
public static function showArticle($id)
{
ArticleModel::where('id', '=', $id)
->update(['is_show'=> 0]);
}
參考
【踩坑系列】strpos() expects parameter 1 to be string, int given