:::

6-9 /get_json.php

01<?php
02/**
03 * Phone Book module
04 *
05 * You may not change or alter any portion of this comment or credits
06 * of supporting developers from this source code or any supporting source code
07 * which is considered copyrighted (c) material of the original comment or credit authors.
08 * This program is distributed in the hope that it will be useful,
09 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11 *
12 * @copyright  The XOOPS Project http://sourceforge.net/projects/xoops/
13 * @license    http://www.fsf.org/copyleft/gpl.html GNU public license
14 * @package    Phone Book
15 * @since      2.5
16 * @author     tad
17 * @version    $Id $
18 **/
19 
20/*-----------引入檔案區--------------*/
21include "header.php";
22 
23/*-----------功能函數區--------------*/
25$content=removeBOM($content);
26$arr=json_decode($content,true);
27 
28$myts = MyTextSanitizer::getInstance();
29 
30foreach ($arr['Infos']['Info'] as $key => $value) {
31  foreach ($value as $k => $v) {
32    $$k=$myts->addSlashes($v);
33  }
34  $sql="insert into `" . $xoopsDB->prefix("restaurant") . "` (`Zipcode`, `Name` ,`Description` ,`Add` ,`Website`) values('$Zipcode', '$Name' , '$Description', '$Add' ,'$Website')";
35  $xoopsDB->queryF($sql) or web_error($sql);
36}
37 
38echo "ok";
39 
40//移除BOM
41function removeBOM($str = '')
42{
43    if (substr($str, 0,3) == pack("CCC",0xef,0xbb,0xbf))
44        $str = substr($str, 3);
45 
46    return $str;
47}

 


:::

搜尋

QR Code 區塊

https%3A%2F%2Ftad0616.cp22.secserverpros.com%2Fmodules%2Ftad_book3%2Fpage.php%3Ftbdsn%3D1256%26tbsn%3D39

書籍目錄

展開 | 闔起

線上使用者

52人線上 (12人在瀏覽線上書籍)

會員: 0

訪客: 52

更多…