📄 json_proxy.php
字号:
<?php/* yadl_spaceid - Skip Stamping */// This script returns a JSON dataset of up to 1396 records in 14 columns// "extid","name","date","price","number","address","company","desc","age","title","phone","email","zip","country"header('Content-type: application/json');// Define defaults$results = -1; // default get all$startIndex = 0; // default start at 0$sort = null; // default don't sort$dir = 'asc'; // default sort dir is asc$sort_dir = SORT_ASC;// How many records to get?if(strlen($_GET['results']) > 0) { $results = $_GET['results'];}// Start at which record?if(strlen($_GET['startIndex']) > 0) { $startIndex = $_GET['startIndex'];}// Sorted?if(strlen($_GET['sort']) > 0) { $sort = $_GET['sort'];}// Sort dir?if((strlen($_GET['dir']) > 0) && ($_GET['dir'] == 'desc')) { $dir = 'desc'; $sort_dir = SORT_DESC;}else { $dir = 'asc'; $sort_dir = SORT_ASC;}// Return the datareturnData($results, $startIndex, $sort, $dir, $sort_dir);function returnData($results, $startIndex, $sort, $dir, $sort_dir) { // All records $allRecords = initArray(); // Need to sort records if(!is_null($sort)) { // Obtain a list of columns foreach ($allRecords as $key => $row) { $sortByCol[$key] = $row[$sort]; } // Valid sort value if(count($sortByCol) > 0) { // Sort the original data // Add $allRecords as the last parameter, to sort by the common key array_multisort($sortByCol, $sort_dir, $allRecords); } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -