Texas Instruments matrix-gui-2.0 hacking -- helper_functions.php
2015-06-18 10:36
330 查看
<?php # PHP_SELF: 但前正在执行脚本的文件名,与document root相关 # QUERY_STRING: 查询(query)的字符串 $cachefile = "cache".$_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING']; # ^ function start_caching() # | { # | //Use the global $cachefile variable # | global $cachefile; # -->---->--+ //There is a random string to the end of the $_GET Query String to //prevent IE from caching the Ajax request. The below line removes the random portion //of the query so we can cache the page properly in php if(stripos($cachefile, "&rand=")==true) $cachefile = substr($cachefile,0,stripos($cachefile, "&rand=")); if (file_exists($cachefile)) { // the page has been cached from an earlier request // output the contents of the cache file include($cachefile); // exit the script, so that the rest isnt executed exit; } else ob_start(); } function get_application($dot_desktop_array,$submenu,$app_name) { for($i = 0;$i<count($dot_desktop_array[$submenu]["apps"]);$i++) { if($dot_desktop_array[$submenu]["apps"][$i]["Name"]==$app_name) return $dot_desktop_array[$submenu]["apps"][$i]; } return NULL; } function end_caching() { //Use the global $cachefile variable global $cachefile; //Disable Caching on Description Page // open the cache file "cache/home.html" for writing $fp = fopen($cachefile, 'w'); // save the contents of output buffer to the file fwrite($fp, ob_get_contents()); // close the file fclose($fp); // Send the output to the browser ob_end_flush(); } function get_submenu($dot_desktop_array,$submenu_name) { # foreach 循环 # $k: 表示数组的下标 # $v: 表示k下标对应的数组值 foreach ($dot_desktop_array as $k => $v) { for($j = 0;$j<count($v["apps"]);$j++) { $current_entry = $v["apps"][$j]; # 如果当前的记录类型是目录,并且当前分类和给定名字一样,那么返回该对象 if($current_entry["Type"]=="directory" && $current_entry["Category"] == $submenu_name) return $current_entry; } } return NULL; } function read_desktop_file() { # 检查json.txt是否存在,并且json.txt文件长度不为0 if(file_exists("json.txt") == true && filesize("json.txt") != 0) { # 打开并读取文件 $handle = fopen("json.txt", "rb"); $contents = fread($handle,filesize("json.txt")); fclose($handle); # 接受一个JSON格式的字符串并且把它转换为PHP变量, # 返回解析后的json对象 return json_decode($contents,true); } else return null; } ?>
相关文章推荐
- Texas Instruments matrix-gui-2.0 hacking -- generate.php
- Texas Instruments matrix-gui-2.0 hacking -- index.php
- 特征学习“Building High-level Features Using Large Scale Unsupervised Learning”
- Texas Instruments matrix-gui-2.0 hacking -- json.txt
- CoreBlueTootch的实现
- UIModalPresentationFormSheet resizing view
- VBoxGuestAdditions.iso下载
- 对象转数组 (用json_encode 和 json_decode(,TRUE)
- 本地通知 UILocalNotification的使用
- Access restriction: The type FtpClient is not accessible due to restriction on required library
- String Stringfuffer Stringbuilder
- iOS8开发~UI布局(二)storyboard中autolayout和size class的使用详解
- easyUI datagrid 查询方法
- Android应用程序UI硬件加速渲染环境初始化过程分析
- 笔记: c开发gui程序 (WM_CREATE, WS_CLIPCHILDREN , SetWindowPos)
- handsontable 和 echarts都定义了require方法,初始化时冲突了,怎么办?
- 【ios开发学习 - 第五课】UITableView使用
- XCode7如何使用UI Test
- 开源视频会议bigbluebutton开发(5)——开发web端,red5应用,桌面共享
- 开源视频会议bigbluebutton开发(5)——开发web端,red5应用,桌面共享