我以前在我的普通mysql_*连接中有这个:
mysql_set_charset("utf8",$link);
mysql_query("SET NAMES 'UTF8'");
Run Code Online (Sandbox Code Playgroud)
我是否需要它用于PDO?我应该在哪里买到它?
$connect = new PDO("mysql:host=$host;dbname=$db", $user, $pass, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
Run Code Online (Sandbox Code Playgroud) 只要我将Laravel应用程序从MySQL移动到pSQL.我一直收到这个错误.
Response内容必须是实现__toString()的字符串或对象,给出"boolean".
我有一个API,假设要退回我的促销活动
public function id($id){
$promotion = Promotion::find($id);
dd($promotion); //I got something here
return $promotion;
}
Run Code Online (Sandbox Code Playgroud)
它曾用于返回我的促销,现在它返回错误.
DD($推广);
I got
Promotion {#410 ?
#table: "promotions"
#connection: null
#primaryKey: "id"
#perPage: 15
+incrementing: true
+timestamps: true
#attributes: array:16 [?
"id" => 1
"cpe_mac" => "000D6721A5EE"
"name" => "qwrqwer"
"type" => "img_path"
"status" => "Active"
"heading_text" => "qwerq"
"body_text" => "werqwerqw"
"img" => stream resource @244 ?}
"img_path" => "/images/promotion/1/promotion.png"
"video_url" => ""
"video_path" => ""
"account_id" => …Run Code Online (Sandbox Code Playgroud)