首页 > CMS教程 > 正文

PHP代理实现用老人机看小说
2020-02-27 21:03:00   来源:   评论:0 点击:

为了应对当前HTML格式和js脚本对老人机的不友好,我们需要处理一下某些小说网站,让它回到十几年前的样子,剔除大量CSS和JS,精简HTML标签,这样就能够让老人机快速、友好地看小说了。 目前下面的脚本就能实现了,可以为老人机提供简单地浏览和必备的搜索
)));

$fix = $fix["dirname"]."/";

}else{

$fix = _remoteurl_;

}

if (strpos($n,"#") !== false) {

$n = substr($n, 0, strpos($n,"#"));

}

if (substr($n, 0, 7) == "http://" || substr($n, 0, 8) == "https://") {

return $n;

}elseif (substr($n, 0, 2) == "//") {

return "http:".$n;

}else{

if (empty($n)) {

return false;

}

if (substr($n, 0, 1) == "/") {

return _remoteurl_.substr($n, 1);

}else{

return $fix.$n;

}

}

}

function _iconv($data, $output = utf-8) {

$encode_arr = array(UTF-8,ASCII,GBK,GB2312,BIG5,JIS,eucjp-win,sjis-win,EUC-JP);

$encoded = mb_detect_encoding($data, $encode_arr);

if (!is_array($data)) {

return mb_convert_encoding($data, $output, $encoded);

} else {

foreach ($data as $key=>$val) {

$key = _iconv($key, $output);

if(is_array($val)) {

$data[$key] = _iconv($val, $output);

} else {

$data[$key] = mb_convert_encoding($data, $output, $encoded);

}

}

return $data;

}

}

相关热词搜索:

上一篇:近 50 种花式 “Hello, World”
下一篇:玩转容器技术

分享到: 收藏