[php]รบกวนช่วยดู code หน่อยครับว่าผิดตรงไหน

เริ่มโดย DewChelsea, 26 มิถุนายน 2015, 13:27:38

หัวข้อก่อนหน้า - หัวข้อถัดไป

0 สมาชิก และ 1 ผู้มาเยือน กำลังดูหัวข้อนี้

DewChelsea

<?php

function getKeywordSuggestionsFromGoogle($keyword) {
    $keywords = array();
    $data = file_get_contents('http://suggestqueries.google.com/complete/search?output=firefox&client=firefox&hl=en-US&q='.urlencode($keyword));
    if (($data = json_decode($data, true)) !== null) {
        $keywords = $data[1];
    }

    return $keywords;
}
var_dump(getKeywordSuggestionsFromGoogle('thaiseo'));

?>

ผลลัพธ์ได้ออกมาแบบนี้ครับ
array(7) { [0]=> string(12) "thaiseoboard" [1]=> string(15) "thaistockmarket" [2]=> string(15) "thaiseo godaddy" [3]=> string(18) "thaiseoboard index" [4]=> string(14) "thaiseo market" [5]=> string(19) "thaiseoboard pantip" [6]=> string(19) "thaiseoboard amazon" }

ซึ่งผมต้องการให้ออกมา แบบไม่ใช่ array เช่น keyword1,keyword2,....

ผมใส่ jason_decode ลงไปแล้วใน code แต่ไม่ทราบว่าผิดตรงไหนครับ ทำไม output จึงออกมาในรูปแบบ array

ขอบคุณครับ  :wanwan017:

icez

[direct=http://www.thzhost.com/]THZHost[/direct] SSD Hosting ไทย/สิงคโปร์ พร้อม firewall ป้องกันการยิงเว็บ + scan ไวรัสในเว็บ