function tpl_function_qishi_get_salary_data_salary_pie($params, &$smarty) { global $db, $_CFG; $arr = explode(',', $params['set']); foreach ($arr as $str) { $a = explode(':', $str); switch ($a[0]) { case "调用名称": $aset['alias'] = $a[1]; break; case "列表名": $aset['listname'] = $a[1]; break; case "地区": $aset['district'] = $a[1]; break; case "职位": $aset['category'] = $a[1]; break; } } $filename = urlencode($aset['district'] . '_' . $aset['category']) . '_salary_pie.cache'; $result = check_cache($filename, 'salary', 7); if (!$result) { $result = dfopen("http://www.74cms.com/salary/get_salary_data_salary_pie.php?district=" . $aset['district'] . "&category=" . $aset['category'] . "&certification=" . $_SERVER['SERVER_NAME']); write_cache($filename, $result, 'salary'); } $smarty->assign($aset['listname'], $result); }
function olc_cache_manufacturers_box($auto_expire = false, $refresh = false) { if ($refresh == true || !read_cache($cache_output, 'manufacturers_box-' . SESSION_LANGUAGE . '.cache' . $_GET['manufacturers_id'], $auto_expire)) { ob_start(); include box_code_script_path('manufacturers.php'); $cache_output = ob_get_contents(); ob_end_clean(); write_cache($cache_output, 'manufacturers_box-' . SESSION_LANGUAGE . '.cache' . $_GET['manufacturers_id']); } return $cache_output; }
function olc_cache_also_purchased($auto_expire = false, $refresh = false) { if ($refresh == true || !read_cache($cache_output, 'also_purchased-' . SESSION_LANGUAGE . '.cache' . $_GET['products_id'], $auto_expire)) { ob_start(); include DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS; $cache_output = ob_get_contents(); ob_end_clean(); write_cache($cache_output, 'also_purchased-' . SESSION_LANGUAGE . '.cache' . $_GET['products_id']); } return $cache_output; }
function olc_cache_categories_box($auto_expire = false, $refresh = false) { global $cPath, $foo, $id, $categories_string; if ($refresh == true || !read_cache($cache_output, 'categories_box-' . SESSION_LANGUAGE . '.cache' . $cPath, $auto_expire)) { ob_start(); include box_code_script_path('categories.php'); $cache_output = ob_get_contents(); ob_end_clean(); write_cache($cache_output, 'categories_box-' . SESSION_LANGUAGE . '.cache' . $cPath); } return $cache_output; }
function unyaml($file) { static $yaml = false; if ($_SERVER['HTTP_HOST'] != 'localhost:8000') { if (cache_exists($file)) { return read_cache($file); } } if (!$yaml) { $yaml = new sfYamlParser(); } $data = $yaml->parse(file_get_contents($file)); $data = fix_comments($data); write_cache($file, $data); return $data; }
function get_db_cache($sql, &$var, $filename, $refresh = false) { $var = array(); // check for the refresh flag and try to the data if ($refresh == true || !read_cache($var, $filename)) { // Didn' get cache so go to the database. // $conn = mysql_connect("localhost", "apachecon", "apachecon"); $res = xtc_db_query($sql); // if ($err = mysql_error()) trigger_error($err, E_USER_ERROR); // loop through the results and add them to an array while ($rec = xtc_db_fetch_array($res)) { $var[] = $rec; } // write the data to the file write_cache($var, $filename); } }
function zen_cache_also_purchased($auto_expire = false, $refresh = false) { if ($refresh == true || !read_cache($cache_output, 'also_purchased-' . $_SESSION['language'] . '.cache' . $_GET['products_id'], $auto_expire)) { ob_start(); include DIR_WS_MODULES . zen_get_module_directory(FILENAME_ALSO_PURCHASED_PRODUCTS); $cache_output = ob_get_contents(); ob_end_clean(); write_cache($cache_output, 'also_purchased-' . $_SESSION['language'] . '.cache' . $_GET['products_id']); } return $cache_output; }
require_once QISHI_ROOT_PATH . 'include/mysql.class.php'; require_once QISHI_ROOT_PATH . 'include/fun_personal.php'; $smarty->cache = false; $db = new mysql($dbhost, $dbuser, $dbpass, $dbname); $act = !empty($_REQUEST['act']) ? trim($_REQUEST['act']) : 'salary'; $smarty->cache = false; $filename = urlencode($_GET['district'] . '_' . $_GET['category']) . '_all_salary.cache'; $result = check_cache($filename, 'salary', 7); if (!$result) { $result = dfopen("http://www.74cms.com/salary/get_salary_data_all_salary.php?district=" . $_GET['district'] . "&category=" . $_GET['category'] . "&certification=" . $_SERVER['SERVER_NAME']); write_cache($filename, $result, 'salary'); } if ($result != "-1") { $result = json_decode($result, true); } else { $result = "error"; } $str1 = $_GET['district'] != '' ? $_GET['district'] : '全国'; $str2 = $_GET['category'] != '' ? $_GET['category'] : '职工'; $str3 = $_GET['category'] != '' ? $_GET['category'] : '企业'; $smarty->assign('str', $str1 . $str2); $smarty->assign('str2', $str1 . $str3); $smarty->assign('all_salary', $result); $filename = urlencode($_GET['district'] . '_' . $_GET['category']) . '_salary_barchart.cache'; $result = check_cache($filename, 'salary', 7); if (!$result) { $result = dfopen("http://www.74cms.com/salary/get_salary_data_salary_barchart.php?district=" . $_GET['district'] . "&category=" . $_GET['category'] . "&certification=" . $_SERVER['SERVER_NAME']); write_cache($filename, $result, 'salary'); } $smarty->assign('salary_barchart_experience', $result); $smarty->display("m/m-salary.html");
function tep_cache_also_purchased($auto_expire = false, $refresh = false) { global $_GET, $language, $languages_id; $cache_output = ''; if (isset($_GET['products_id']) && is_numeric($_GET['products_id'])) { if ($refresh == true || !read_cache($cache_output, 'also_purchased-' . $language . '.cache' . $_GET['products_id'], $auto_expire)) { ob_start(); include DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS; $cache_output = ob_get_contents(); ob_end_clean(); write_cache($cache_output, 'also_purchased-' . $language . '.cache' . $_GET['products_id']); } } return $cache_output; }
function tep_cache_categories_superfish_box($auto_expire = false, $refresh = false) { global $cPath, $language; $cache_output = ''; if ($refresh == true || !read_cache($cache_output, 'categories_superfish_box-' . $language . '.cache' . $cPath, $auto_expire)) { if (!class_exists('bm_categories_superfish')) { include DIR_WS_MODULES . 'boxes/bm_categories_superfish.php'; } $bm_categories_superfish = new bm_categories_superfish(); $cache_output = $bm_categories_superfish->getData(); write_cache($cache_output, 'categories_superfish_box-' . $language . '.cache' . $cPath); } return $cache_output; }
function tep_cache_authors_box($auto_expire = false, $refresh = false) { global $_GET, $language; $authors_id = ''; if (isset($_GET['authors_id']) && tep_not_null($_GET['authors_id'])) { $authors_id = $_GET['authors_id']; } if ($refresh == true || !read_cache($cache_output, 'authors_box-' . $language . '.cache' . $authors_id, $auto_expire)) { ob_start(); include DIR_WS_BOXES . 'authors.php'; $cache_output = ob_get_contents(); ob_end_clean(); write_cache($cache_output, 'authors_box-' . $language . '.cache' . $authors_id); } return $cache_output; }
function get_books($version) { global $dbs_book_codes; global $osis_book_codes; global $is_cache_enabled; global $clear_cache; $cache_key = $version . '-info.json'; $result = null; if ($is_cache_enabled && !$clear_cache) { $result = read_cache($cache_key, true); } if ($result == null) { /* copyright info */ $abs_version_data = get_abs_data('https://bibles.org/v2/versions/' . $version . '.js'); $abs_version = $abs_version_data->response->versions[0]; $aboutHtml = '<h1>' . $abs_version->name . ' (' . $abs_version->abbreviation . ')' . '</h1>' . '<dl>' . '<dt>Copyright</dt>' . '<dd>' . $abs_version->copyright . '</dd>' . '<dt>Info</dt>' . '<dd>' . ($text = preg_replace('/<h\\d>(.*)<\\/h\\d>/', '', $abs_version->info) . '</dd>' . '<dt>Source</dt>' . '<dd>This text comes from the <a href="https://bibles.org/pages/api/">BIBLESEARCH API</a> provided by <a href="http://www.americanbible.org/">American Bible Society</a></dd>' . '<dt>API EULA</dt>' . '<dd><a href="https://bibles.org/pages/legal#terms">End User License Agreement</a> for API</dd>' . '</dl>'); $abs_data = get_abs_data('https://bibles.org/v2/versions/' . $version . '/books.js'); if ($abs_data == null) { return null; } $abs_books = $abs_data->response->books; $divisions = array(); $divisionNames = array(); $divisionAbbreviations = array(); $sections = array(); //$chapters = array(); foreach ($abs_books as &$abs_book) { $dbs_book_code = osis_code_to_dbs($abs_book->abbr); if ($dbs_book_code != null) { array_push($divisions, $dbs_book_code); array_push($divisionNames, $abs_book->name); array_push($divisionAbbreviations, $abs_book->abbr); // find the last chapter $osis_end = $abs_book->osis_end; // "eng-AMP:Gen.50.26 $osis_end_parts = explode('.', $osis_end); $last_chapter = $osis_end_parts[1]; //array_push($chapters, $last_chapter); //array_push($sections, $osis_end); // sizeof($osis_end_parts)); // $dbs_book_code . strval($last_chapter)); // create sections for ($c = 1; $c <= $last_chapter; $c++) { array_push($sections, $dbs_book_code . strval($c)); } } } $result = array(aboutHtml => $aboutHtml, divisions => $divisions, divisionNames => $divisionNames, divisionAbbreviations => $divisionAbbreviations, sections => $sections); if ($is_cache_enabled) { write_cache($cache_key, $result, true); $is_from_cache = true; } } $result["cache_key"] = ${$cache_key}; $result["is_from_cache"] = $is_from_cache; return $result; }
function eve_crawl_url($url, $iteration) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"); #pretend we're IE curl_setopt($ch, CURLOPT_TIMEOUT, 20); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $page = curl_exec($ch); if (strpos($page, "That kill doesn't exist.")) { echo "ERROR: Kill Doesn't Exist.<br />\n"; write_cache($iteration); return false; } $location_format = "#system_detail&sys_id=([0-9]+)\">([a-zA-Z0-9- ']+)</a></b>#"; preg_match($location_format, $page, $matches); $location = $matches[2]; if (empty($location)) { echo "ERROR: #{$iteration}, LOCATION.<br />\n"; write_cache($iteration); return false; } $location_id = item_to_id($location, "wt_systems"); $date_format = "#<td class=kb-table-cell>([0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2})</td>#"; preg_match($date_format, $page, $matches); $date = $matches[1]; if (empty($date)) { echo "ERROR: #{$iteration}, DATE.<br />\n"; write_cache($iteration); return false; } $loss_isk_format = "#<td class=kb-table-cell>([0-9,]+\\.[0-9]{2})</td>#"; preg_match($loss_isk_format, $page, $matches); $loss_isk = round(ereg_replace("[^0-9.]", "", $matches[1])); if (empty($loss_isk)) { echo "ERROR: #{$iteration}, LOSS ISK. Continuing...<br />\n"; write_cache($iteration); $loss_isk = 0; } $victim_format = '#<td class=kb-table-cell><b><a href="\\?a=pilot_detail&plt_id=([0-9]+)">([a-zA-Z0-9- \']+)</a></b></td>#'; preg_match($victim_format, $page, $matches); $victim_name = $matches[2]; if (empty($victim_name)) { echo "ERROR: #{$iteration}, VICTIM NAME.<br />\n"; write_cache($iteration); return false; } $victim_id = item_to_id($victim_name, "wt_player"); $victim_corp_format = '#<td class=kb-table-cell><b><a href="\\?a=corp_detail&crp_id=([0-9]+)">([a-zA-Z0-9 \'\\-.]+)</a></b></td>#'; preg_match($victim_corp_format, $page, $matches); $victim_corp_name = $matches[2]; if (empty($victim_corp_name)) { echo "ERROR: #{$iteration}, VICTIM CORP NAME.<br />\n"; write_cache($iteration); return false; } $victim_corp_id = item_to_id($victim_corp_name, "wt_corporation"); $victim_alliance_format = '#<b><a href="\\?a=alliance_detail&all_id=[0-9]+">([a-zA-Z0-9 \'\\-.]+)[</a>]*</b></td>#'; preg_match($victim_alliance_format, $page, $matches); $victim_alliance_name = $matches[1]; if (empty($victim_alliance_name)) { echo "ERROR: #{$iteration}, VICTIM ALLIANCE NAME.<br />\n"; write_cache($iteration); return false; } $victim_alliance_id = item_to_id($victim_alliance_name, "wt_alliance"); $victim_ship_format = '#<td class=kb-table-cell><b><a href="\\?a=invtype&id=([0-9]+)">([a-zA-Z0-9 \'\\-.]+)</a></b></td>#'; preg_match($victim_ship_format, $page, $matches); $victim_ship_name = $matches[2]; if (empty($victim_ship_name)) { echo "ERROR: #{$iteration}, VICTIM SHIP NAME.<br />\n"; write_cache($iteration); return false; } $victim_ship_id = item_to_id($victim_ship_name, "wt_ships"); $killer_name_format = '#<a href="\\?a=pilot_detail&plt_id=[0-9]+"><b>([0-9a-zA-Z \']+)[ \\(Final Blow\\)]*</b></a></td>#'; preg_match_all($killer_name_format, $page, $matches); #print_r($matches[1]); $killer_names = $matches[1]; $killer_corp_format = '#<a href="\\?a=corp_detail&crp_id=[0-9]+">([0-9a-zA-Z -.\']+)</a></td>#'; preg_match_all($killer_corp_format, $page, $matches); #print_r($matches[1]); $killer_corps = $matches[1]; $killer_ship_format = '#1px;"><b><a href="\\?a=invtype&id=[0-9]+">([0-9a-zA-Z ]+)</a></b></td>#'; preg_match_all($killer_ship_format, $page, $matches); #print_r($matches[1]); $killer_ships = $matches[1]; $killer_alliance_format = '#style="padding-top: 1px; padding-bottom: 1px;"><a href="\\?a=alliance_detail&all_id=[0-9]+">([0-9a-zA-Z-. \']+)</a></td>#'; preg_match_all($killer_alliance_format, $page, $matches); #print_r($matches[1]); $killer_alliances = $matches[1]; $size_killer_names = sizeof($killer_names); $size_killer_corps = sizeof($killer_corps); $size_killer_ships = sizeof($killer_ships); $size_killer_alliances = sizeof($killer_alliances); if ($size_killer_names != $size_killer_corps || $size_killer_ships != $size_killer_alliances || $size_killer_names != $size_killer_ships) { echo "ERROR: #{$iteration}, KILLER ARRAY MISMATCH [n:{$size_killer_names}, c:{$size_killer_corps}, s:{$size_killer_ships}, a:{$size_killer_alliances}].<br />\n"; write_cache($iteration); return false; } $victim_fit_format = '# <td class="kb-table-cell">([0-9a-zA-Z -\'/.]+)</td>#'; preg_match_all($victim_fit_format, $page, $matches); #print_r($matches[1]); $victim_fits = $matches[1]; runQuery("INSERT INTO wt_player_sighting SET player_id = '{$victim_id}', corp_id = '{$victim_corp_id}', alliance_id = '{$victim_alliance_id}', ship_id = '{$victim_ship_id}', time='{$date}', system_id = '{$location_id}'"); $player_sighting_id = mysql_insert_id(); runQuery("INSERT INTO wt_ship_loss SET cost = '{$loss_isk}', player_sighting_id = '{$player_sighting_id}'"); $ship_loss_id = mysql_insert_id(); for ($i = 0; $i < sizeof($killer_names); $i++) { $killer_player_id = item_to_id($killer_names[$i], "wt_player"); $killer_corp_id = item_to_id($killer_corps[$i], "wt_corporation"); $killer_ship_id = item_to_id($killer_ships[$i], "wt_ships"); $killer_alliance_id = item_to_id($killer_alliances[$i], "wt_alliance"); runQuery("INSERT INTO wt_player_sighting SET player_id = '{$killer_player_id}', corp_id = '{$killer_corp_id}', alliance_id = '{$killer_alliance_id}', ship_id = '{$killer_ship_id}', time='{$date}', system_id = '{$location_id}'"); $killer_sighting_id = mysql_insert_id(); runQuery("INSERT INTO wt_ship_kill SET player_instance_id = '{$killer_sighting_id}', ship_loss_id = '{$ship_loss_id}'"); } for ($i = 0; $i < sizeof($victim_fits); $i++) { $item_id = item_to_id($victim_fits[$i], "wt_items"); runQuery("INSERT INTO wt_item_to_ship_loss SET ship_loss_id = '{$ship_loss_id}', item_id = '{$item_id}'"); } write_cache($iteration); set_time_limit(10); return true; }
write_cache('eep', $hash, $file); } else { // has cache $file = $cache; } } // make c file if ($filetype == 'c') { $filename = 'keymap.c'; $hash = sha1(serialize(array('matrix_rows' => $matrix_rows, 'matrix_cols' => $matrix_cols, 'max_layers' => $max_layers, 'max_fns' => $max_fns, 'keymaps' => $keymaps, 'fn_actions' => $fn_actions))); // check cache $cache = check_cache('c', $hash); if (is_null($cache)) { // no cache $file = generate_c_file($matrix_rows, $matrix_cols, $max_layers, $max_fns, $keymaps, $fn_actions); write_cache('c', $hash, $file); } else { // has cache $file = $cache; } // prepend header $header = generate_c_header(); $file = $header . $file; } // download header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="' . $filename . '"'); header('Content-Length: ' . strlen($file)); echo $file; //var_dump($keymaps); exit;
function tep_cache_product_finder($auto_expire = false, $refresh = false) { global $cPath, $_GET, $language, $languages_id, $cPath_array, $specification_group; if ($refresh == true || !read_cache($cache_output, 'product_finder-' . $language . '.cache' . $cPath, $auto_expire)) { ob_start(); include DIR_WS_MODULES . 'product_finder.php'; $cache_output = ob_get_contents(); ob_end_clean(); write_cache($cache_output, 'product_finder-' . $language . '.cache' . $cPath); } return $cache_output; }
} //This file will re create your archives and generate your cache. include ROOT_DIR . "/" . INC_DIR . "/make_archive.php"; $t1 = microtime(true); echo '<li>Archive creation : '; flush_buffers(); write_archive(); echo '<!-- Time write archive: ', microtime(true) - $t1, " -->\n"; echo '<font color="green">DONE</font></li>' . "<br />\n"; flush_buffers(); include ROOT_DIR . '/' . INC_DIR . "/make_cache.php"; $t1 = microtime(true); set_time_limit(0); echo '<li>Cache creation/update :'; flush_buffers(); write_cache(); set_time_limit(30); echo '<!-- Time make cache: ', microtime(true) - $t1, " -->\n"; echo '<font color="green">DONE</font></li>' . "<br />\n"; flush_buffers(); include ROOT_DIR . '/' . INC_DIR . "/make_feed.php"; $t1 = microtime(true); echo '<li>Feed creation/update : '; flush_buffers(); write_feed(); echo '<!-- Time make feed: ', microtime(true) - $t1, " -->\n"; echo '<font color="green">DONE</font></li>' . "<br />\n"; flush_buffers(); echo 'The blog is updated, you may <a href="' . URL . '">go back</a>.' . "<br>\n"; echo '<!-- Total: ', microtime(true) - $total, " -->\n"; echo '<!-- Memory Consumption: ', memory_get_usage(true), "(bytes) -->\n";
} //echo $sys_description; /* //整合站点信息为数组,便于缓存和模板输出 $siteinfo_new["site_name"] = $sys_title; $siteinfo_new["site_keywords"] = $sys_keywords; $siteinfo_new["site_description"] = $sys_description; */ /* $ //写缓存操作(如果缓存机制开启的话) if( 开启缓存机制 ){ 写缓存操作; } */ //这里暂未考虑缓存机制开启选项(需要修改缓存的内容——缓存指定的信息) write_cache($sys_dir . 'data/cache/SiteInfo.cache', $siteinfo_new); } //输出 系统基本模板变量 $tpl->assign("title", $siteinfo_new["site_name"]); $tpl->assign("keywords", $siteinfo_new["site_keywords"]); $tpl->assign("description", $siteinfo_new["site_description"]); $tpl->assign("charset", $sys_charset); //检测系统是否关闭 //判断 如果站点设置为:关闭,则关闭系统,只允许管理员进入系统 if ($siteinfo_new["if_close"] == 1) { //跳转到相应的控制器 —— 显示关闭原因 + 登陆框 }
$line[$value['click_type']][$value['addtime']] += 1; } $item = 0; foreach ($labelArr as $key => $value) { $label[$item]['label'] = date('m-d', $value); $lineData[0][$item]['value'] = intval($line[1][$value]); $lineData[1][$item]['value'] = intval($line[2][$value]); $lineData[2][$item]['value'] = intval($line[3][$value]); $item++; } $categories = array('category' => array($label)); $categories = json_encode($categories); $dataset = array(array('seriesname' => iconv('gbk', 'utf-8', '点击数'), 'data' => array($lineData[0])), array('seriesname' => iconv('gbk', 'utf-8', '点赞数'), 'data' => array($lineData[1])), array('seriesname' => iconv('gbk', 'utf-8', '分享数'), 'data' => array($lineData[2]))); $dataset = json_encode($dataset); write_cache('u' . $_SESSION['uid'] . '_wzp_categories_' . $filter . '.cache', $categories, 'wzp'); write_cache('u' . $_SESSION['uid'] . '_wzp_dataset_' . $filter . '.cache', $dataset, 'wzp'); } $smarty->assign('categories', $categories); $smarty->assign('dataset', $dataset); /** * 图表统计end **/ $smarty->assign('data', $arr); $smarty->assign('title', '微信招聘 - 企业会员中心 - ' . $_CFG['site_name']); $smarty->display('member_company/company_data_statistics.htm'); } else { $link[0]['text'] = "完善企业资料"; $link[0]['href'] = 'company_info.php?act=company_profile'; showmsg("为了更好的显示微信招聘效果,请先完善您的企业资料!", 1, $link); } }
function tep_cache_also_purchased($auto_expire = false, $refresh = false) { $cache_output = ''; if (isset($_GET['products_id']) && is_numeric($_GET['products_id'])) { if ($refresh == true || !read_cache($cache_output, 'also_purchased-' . $_SESSION['language'] . '.cache' . $_GET['products_id'], $auto_expire)) { ob_start(); include 'includes/modules/also_purchased_products.php'; $cache_output = ob_get_contents(); ob_end_clean(); write_cache($cache_output, 'also_purchased-' . $_SESSION['language'] . '.cache' . $_GET['products_id']); } } return $cache_output; }
<?php $cache_contents = ob_get_contents(); write_cache($cache_file, $cache_contents);
} $loc_9 = str_replace('^', 0, urldecode($loc_8)); return $loc_9; } if (!read_cache("music") || time() - filemtime(md5("music") . ".php") > 3600 * 5) { $explode = explode(",", $xiamiID); //print_r($explode);exit; $array = array(); $no = 0; foreach ($explode as $k => $id) { $content = http('http://www.xiami.com/widget/xml-single/sid/' . $id . '/'); preg_match_all("/<album_cover><\\!\\[CDATA\\[([^\\]].*)\\]\\]><\\/album_cover>/i", $content, $cover); preg_match_all("/<song_name><\\!\\[CDATA\\[([^\\]].*)\\]\\]><\\/song_name>/i", $content, $name); preg_match_all("/<artist_name><\\!\\[CDATA\\[([^\\]].*)\\]\\]><\\/artist_name>/i", $content, $art); preg_match_all("/<location><\\!\\[CDATA\\[([^\\]].*)\\]\\]><\\/location>/i", $content, $location); // echo var_dump($name[1][0]); if (!empty($name[1][0])) { $array[$no]['url'] = xiami($location[1][0]); $array[$no]['name'] = $name[1][0]; $array[$no]['art'] = $art[1][0]; $array[$no]['image'] = $cover[1][0]; $no++; } } $json = json_encode($array); write_cache("music", $json); } else { $json = read_cache("music"); } echo $json; exit;