2017-09-16 66 views
0

我在postman中獲得如下值的輸出。 [{ 「CURRENTVERSION」:1.1}]從Laravel查詢生成器獲取結果作爲簡單值

我怎樣才能輸出簡單的形式爲:1.1

$currentVersion = DB::table('app_Version') 
    ->select('currentVersion') 
    ->get(); 
echo $currentVersion 

我怎樣才能輸出簡單的形式爲: 1.1

回答

1

你會更多信息:

echo $currentVersion[0]->currentVersion; 

但是,如果你知道你將永遠有一個記錄,你可以簡化這個有點有:

$result = DB::table('app_Version')->first(['currentVersion']); 
echo $result->currentVersion;