1
我試圖在PHP Slim framework
中執行一個獲取請求。但是我的MYSQL
數據庫中有一個BLOB
變量。其中包含strings
的array
。如何檢索BLOB
變量並將其轉換回strings
的array
。帶有BLOB變量的Slim GET請求
這裏是我取的方法
// fetch all apps
$app->get('/apps', function ($request, $response, $args) {
$sth = $this->db->prepare("SELECT * FROM app ORDER BY updated_at");
$sth->execute();
$apps = $sth->fetchAll();
return $this->response->withJson($apps);
});
這裏$apps
有一個名爲locale
變量,它是BLOB
。我想退回$apps
與array
的strings
如何被存儲到BLOB字符串數組?什麼是當前代碼的JSON輸出? –