爲幫母親而寫的php遠程訪問chrome書籤的程序~

母親有時會上網逛一下網店,有喜歡或須要的東西就用chrome收藏起來,我回來後幫她拍下付費。php

如何瀏覽到她收藏的東西是個問題,若是去她電腦上操做,須要登陸用戶,裝安全控件啥啥的弄一大堆,並且我喜歡先在米折上折一下,再買。再加上她電腦有點慢,每次都要弄半天。前端

想了想,寫了個簡單的程序。能夠遠程和本地訪問chrome收藏文件。chrome

程序我打包放網盤了,請各位老師批評指正:http://pan.baidu.com/s/1pJ18ZYb json

程序用php開發,使用流行的CodeIgniter框架,前端用了zTree。 安全

很是很是簡單,主要代碼以下: app

配置文件:\Bookmarks\application\config\base_config.php 框架

<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*基礎配置*/
$config['where']='remote';//遠程訪問仍是本地訪問,默認本地local,遠程remote
$config['address_local']='C:\Program Files (x86)\Chrome\Google\Chrome\User Data\Default\Bookmarks';//本地地址
$config['address_remote']="//192.168.0.17/Default/Bookmarks";//遠程訪問地址
?>


控制器:this

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Bookmarks extends CI_Controller {
public function show($default='local')
{
$data['default']=$default;
$this->load->helper('url'); 
$this->load->config('base_config');
if($default=='local')  //用傳參方式
{
$file= $this->config->item('address_local');
}
elseif($default=='remote')
{
$file= $this->config->item('address_remote');
}
else
{
exit('Parameter error!!');
}
if(file_exists($file))
{
$json=file_get_contents($file);
$data['json']=$json;
$arr=json_decode($json,true);
$data['json']=json_encode($arr['roots']['bookmark_bar']);
$this->load->view('bookmarks_view',$data);
}
else
{
$this->load->view('no_find_view',$data);
}
}
}


呵,有時爲工做之外的事寫個程序,也挺好玩的。url

程序我打包放網盤了,請各位老師批評指正:http://pan.baidu.com/s/1pJ18ZYb
spa

小弟個人微博:http://weibo.com/cavalryblack  有事木事聯繫聯繫~~



另外和你們說一下,米折頗有趣,想買什麼東西前,把要買的標題放米折裏過一下,再拍就有返利。固然返的和買東西的錢比,很是很是少。不過聊勝於無,到如今已經返我200多元了。我家今年的水費基本都是用米折返的錢交的~~ 地址素:  http://www.mizhe.com/#NEWnZ2ZUl2ZFp2

相關文章
相關標籤/搜索