我有很多地方通過。之前,我只是靜靜地設置這些位置。現在,我創建了一個公司表格,並創建了一個用於添加,刪除和更新公司詳細信息的界面。因此,自創建通行證以來,我應該創建公司的這些位置。因此,我應該如何動態設置它們?我用這樣的代碼靜態地點:
如何設置動態通過位置
$pass->setJSON('{........... "locations" : [ { "longitude" : 104.89529371261597, "latitude" : 11.576150037278605, "relevantText": "CamMob (dis. 1%)" }, { "longitude" : 104.89823341369629, "latitude" : 11.570705493829758, "relevantText": "ITC (dis. 2%)" }, { "longitude" : 104.91380631923676, "latitude" : 11.553425198985883, "relevantText": "Digi (dis. 10%)" }, { "longitude" : 104.92096781730652, "latitude" : 11.569580835552655, "relevantText": "Central market (dis. 10%)" }, { "longitude" : 104.89310503005981, "latitude" : 11.569444194519487, "relevantText": "IFL (dis. 20%)" }, { "longitude" : 104.89041209220886, "latitude" : 11.568655879564044, "relevantText": "RUPP (dis. 5%)" }, { "longitude" : 104.89643096923828, "latitude" : 11.568613836037402, "relevantText": "Children hospital (dis. 50%)" }, { "longitude" : 104.89986419677734, "latitude" : 11.566343476220418, "relevantText": "Santhormuk high school (dis. 15%)" }, { "longitude" : 104.89693522453308, "latitude" : 11.573774631737194, "relevantText": "Royal ratanak hospital (dis. 25%)" }, { "longitude" : 104.89693522453308, "latitude" : 11.573774631737194, "relevantText": "AEU (dis. 30%)" }, { "longitude" : 104.8942369222641, "latitude" : 11.561511017118434, "relevantText": "Moon Car Wash (dis. 10%)" }, { "longitude" : 104.92413818836212, "latitude" : 11.553772076702026, "relevantText": "Auto Spa (dis. 10%)" }, { "longitude" : 104.9108076095581, "latitude" : 11.545604569281316, "relevantText": "Penh Chet (dis. 5%)" }, { "longitude" : 104.89751189947128, "latitude" : 11.590985354685541, "relevantText": "E-garage (dis. 5%)" }, { "longitude" : 104.91095378994942, "latitude" : 11.562604174491218, "relevantText": "Futaba Garage (dis. 5%)" }, { "longitude" : 104.91638526320457, "latitude" : 11.55557478276799, "relevantText": "Haojue Motorcycle (dis. 3%)" }, { "longitude" : 104.90114092826843, "latitude" : 11.545636104516502, "relevantText": "Ice City Skating Rink (dis. 20%)" }, { "longitude" : 104.93705168366432, "latitude" : 11.5573354320172, "relevantText": "Galaxkate (dis. 10%)" }, { "longitude" : 104.92472290992737, "latitude" : 11.553572359281521, "relevantText": "G-rise photography (dis. 20%)" }, { "longitude" : 104.92827415466309, "latitude" : 11.556431458262171, "relevantText": "Portor School International Kindergarten (dis. 5%)" }, { "longitude" : 104.92472290992737, "latitude" : 11.553572359281521, "relevantText": "Cambridge International School of Cambodia (dis. 15%)" }, { "longitude" : 104.89523202180862, "latitude" : 11.569042154169637, "relevantText": "EZECOM (dis. 35.5%)" } ] }');
取出記錄,產生一個數組,並將其編碼成json字符串。 – Rikesh 2013-05-09 04:47:11
如何使用數組通過從公司表中進行選擇來設置它們? – malinchhan 2013-05-09 04:47:26
「locations」:[ {「longitude」:「'。$ long。'」, 「latitude」:「'。$ lat。'」, 「relevantText」:「'。$ name。' '。$ discount。'「 }} – malinchhan 2013-05-09 04:57:47