ter = array_value($config, 'filter');
$arr = array_value($filter, $type);
$enable = array_value($arr, 'enable');
$wordarr = array_value($arr, 'keyword');
if (0 == $enable || empty($wordarr)) return FALSE;
foreach ($wordarr as $_keyword) {
if (!$_keyword) continue;
$r = strpos(strtolower($keyword), strtolower($_keyword));
if (FALSE !== $r) {
$error = $_keyword;
return TRUE;
}
}
return FALSE;
}
// return http://domain.com OR https://domain.com
function url_prefix()
{
$http = ((isset($_SERVER['HTTPS']) && 'on' == $_SERVER['HTTPS']) || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')) ? 'https://' : 'http://';
return $http . $_SERVER['HTTP_HOST'];
}
// 唯一身份ID
function uniq_id()
{
return uniqid(substr(md5(microtime(true) . mt_rand(1000, 9999)), 8, 8));
}
// 生成订单号 14位
function trade_no()
{
$trade_no = str_replace('.', '', microtime(1));
$strlen = mb_strlen($trade_no, 'UTF-8');
$strlen = 14 - $strlen;
$str = '';
if ($strlen) {
for ($i = 0; $i <= $strlen; $i++) {
if ($i < $strlen) $str .= '0';
}
}
return $trade_no . $str;
}
// 生成订单号 16位
function trade_no_16()
{
$explode = explode(' ', microtime());
$trade_no = $explode[1] . mb_substr($explode[0], 2, 6, 'UTF-8');
return $trade_no;
}
// 当前年的天数
function date_year($time = NULL)
{
$time = intval($time) ? $time : time();
return date('L', $time) + 365;
}
// 当前年份中的第几天
function date_z($time = NULL)
{
$time = intval($time) ? $time : time();
return date('z', $time);
}
// 当前月份中的第几天,没有前导零 1 到 31
function date_j($time = NULL)
{
$time = intval($time) ? $time : time();
return date('j', $time);
}
// 当前月份中的第几天,有前导零的2位数字 01 到 31
function date_d($time = NULL)
{
$time = intval($time) ? $time : time();
return date('d', $time);
}
// 当前时间为星期中的第几天 数字表示 1表示星期一 到 7表示星期天
function date_w_n($time = NULL)
{
$time = intval($time) ? $time : time();
return date('N', $time);
}
// 当前日第几周
function date_d_w($time = NULL)
{
$time = intval($time) ? $time : time();
return date('W', $time);
}
// 当前几月 没有前导零1-12
function date_n($time = NULL)
{
$time = intval($time) ? $time : time();
return date('n', $time);
}
// 当前月的天数
function date_t($time = NULL)
{
$time = intval($time) ? $time : time();
return date('t', $time);
}
// 0 o'clock on the day
function clock_zero()
{
return strtotime(date('Ymd'));
}
// 24 o'clock on the day
function clock_twenty_four()
{
return strtotime(date('Ymd')) + 86400;
}
// 8点过期 / expired at 8 a.m.
function eight_expired($time = NULL)
{
$time = intval($time) ? $time : time();
// 当前时间大于8点则改为第二天8点过期
$life = date('G') <= 8 ? (strtotime(date('Ymd')) + 28800 - $time) : clock_twenty_four() - $time + 28800;
return $life;
}
// 24点过期 / expired at 24 a.m.
function twenty_four_expired($time = NULL)
{
$time = intval($time) ? $time : time();
$twenty_four = clock_twenty_four();
$life = $twenty_four - $time;
return $life;
}
/**
* @param $url 提交地址
* @param string $post POST数组 / 空为GET获取数据 / $post='GET'获取连续跳转最终URL
* @param string $cookie cookie
* @param int $timeout 超时
* @param int $ms 设为1是毫秒
* @return mixed 返回数据
*/
function https_request($url, $post = '', $cookie = '', $timeout = 30, $ms = 0)
{
if (empty($url)) return FALSE;
if (version_compare(PHP_VERSION, '5.2.3', '<')) {
$ms = 0;
$timeout = 30;
}
is_array($post) and $post = http_build_query($post);
// 没有安装curl 使用http的形式,支持post
if (!extension_loaded('curl')) {
//throw new Exception('server not install CURL');
if ($post) {
return https_post($url, $post, $cookie, $timeout);
} else {
return http_get($url, $cookie, $timeout);
}
}
is_array($cookie) and $cookie = http_build_query($cookie);
$curl = curl_init();
// 返回执行结果,不输出
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
//php5.5跟php5.6中的CURLOPT_SAFE_UPLOAD的默认值不同
if (class_exists('\CURLFile')) {
curl_setopt($curl, CURLOPT_SAFE_UPLOAD, true);
} else {
defined('CURLOPT_SAFE_UPLOAD') and curl_setopt($curl, CURLOPT_SAFE_UPLOAD, false);
}
// 设定请求的RUL
curl_setopt($curl, CURLOPT_URL, $url);
// 设定返回信息中包含响应信息头
if (ini_get('safe_mode') && ini_get('open_basedir')) {
// $post参数必须为GET
if ('GET' == $post) {
// 安全模式时将头文件的信息作为数据流输出
curl_setopt($curl, CURLOPT_HEADER, true);
// 安全模式采用连续抓取
curl_setopt($curl, CURLOPT_NOBODY, true);
}
} else {
curl_setopt($curl, CURLOPT_HEADER, false);
// 允许跳转10次
curl_setopt($curl, CURLOPT_MAXREDIRS, 10);
// 使用自动跳转,返回最后的Location
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
}
$ua1 = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1';
$ua = empty($_SERVER["HTTP_USER_AGENT"]) ? $ua1 : $_SERVER["HTTP_USER_AGENT"];
curl_setopt($curl, CURLOPT_USERAGENT, $ua);
// 兼容HTTPS
if (FALSE !== stripos($url, 'https://')) {
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
//ssl版本控制
//curl_setopt($curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1);
curl_setopt($curl, CURLOPT_SSLVERSION, true);
}
$header = array('Content-type: application/x-www-form-urlencoded;charset=UTF-8', 'X-Requested-With: XMLHttpRequest');
$cookie and $header[] = "Cookie: $cookie";
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
if ($post) {
// POST
curl_setopt($curl, CURLOPT_POST, true);
// 自动设置Referer
curl_setopt($curl, CURLOPT_AUTOREFERER, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $post);
}
if ($ms) {
curl_setopt($curl, CURLOPT_NOSIGNAL, true); // 设置毫秒超时
curl_setopt($curl, CURLOPT_TIMEOUT_MS, intval($timeout)); // 超时毫秒
} else {
curl_setopt($curl, CURLOPT_TIMEOUT, intval($timeout)); // 秒超时
}
//优先解析 IPv6 超时后IPv4
//curl_setopt($curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
curl_setopt($curl, CURLOPT_ENCODING, 'gzip');
// 返回执行结果
$output = curl_exec($curl);
// 有效URL,输出URL非URL页面内容 CURLOPT_RETURNTRANSFER 必须为false
'GET' == $post and $output = curl_getinfo($curl, CURLINFO_EFFECTIVE_URL);
curl_close($curl);
return $output;
}
function save_image($img)
{
$ch = curl_init();
// 设定请求的RUL
curl_setopt($ch, CURLOPT_URL, $img);
// 设定返回信息中包含响应信息头 启用时会将头文件的信息作为数据流输出
//curl_setopt($ch, CURLOPT_HEADER, false);
//curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER["HTTP_USER_AGENT"]);
// true表示$html,false表示echo $html
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
//curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
//curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_ENCODING, 'gzip');
$output = curl_exec($ch);
curl_close($ch);
return $output;
}
// 计算字串宽度:剧中对齐(字体大小/字串内容/字体链接/背景宽度/倍数)
function calculate_str_width($size, $str, $font, $width, $multiple = 2)
{
$box = imagettfbbox($size, 0, $font, $str);
return ($width - $box[4] - $box[6]) / $multiple;
}
// 搜索目录下的文件 比对文件后缀
function search_directory($path)
{
if (is_dir($path)) {
$paths = scandir($path);
foreach ($paths as $val) {
$sub_path = $path . '/' . $val;
if ('.' == $val || '..' == $val) {
continue;
} else if (is_dir($sub_path)) {
//echo '目录名:' . $val . ' ';
search_directory($sub_path);
} else {
//echo ' 最底层文件: ' . $path . '/' . $val . '
';
$ext = strtolower(file_ext($sub_path));
if (in_array($ext, array('php', 'asp', 'jsp', 'cgi', 'exe', 'dll'), TRUE)) {
echo '异常文件:' . $sub_path . ' ';
}
}
}
}
}
// 一维数组转字符串 $sign待签名字符串 $url为urlencode转码GET参数字符串
function array_to_string($arr, &$sign = '', &$url = '')
{
if (count($arr) != count($arr, 1)) throw new Exception('Does not support multi-dimensional array to string');
// 注销签名
unset($arr['sign']);
// 排序
ksort($arr);
reset($arr);
// 转字符串做签名
$url = '';
$sign = '';
foreach ($arr as $key => $val) {
if (empty($val) || is_array($val)) continue;
$url .= $key . '=' . urlencode($val) . '&';
$sign .= $key . '=' . $val . '&';
}
$url = substr($url, 0, -1);
$url = htmlspecialchars($url);
$sign = substr($sign, 0, -1);
}
// 私钥生成签名
function rsa_create_sign($data, $key, $sign_type = 'RSA')
{
if (!function_exists('openssl_sign')) throw new Exception('OpenSSL extension is not enabled');
if (!defined('OPENSSL_ALGO_SHA256')) throw new Exception('Only versions above PHP 5.4.8 support SHA256');
$key = wordwrap($key, 64, "\n", true);
if (FALSE === $key) throw new Exception('Private Key Error');
$key = "-----BEGIN RSA PRIVATE KEY-----\n$key\n-----END RSA PRIVATE KEY-----";
if ('RSA2' == $sign_type) {
openssl_sign($data, $sign, $key, OPENSSL_ALGO_SHA256);
} else {
openssl_sign($data, $sign, $key, OPENSSL_ALGO_SHA1);
}
// 加密
return base64_encode($sign);
}
// 公钥验证签名
function rsa_verify_sign($data, $sign, $key, $sign_type = 'RSA')
{
$key = wordwrap($key, 64, "\n", true);
if (FALSE === $key) throw new Exception('Public Key Error');
$key = "-----BEGIN PUBLIC KEY-----\n$key\n-----END PUBLIC KEY-----";
// 签名正确返回1 签名不正确返回0 错误-1
if ('RSA2' == $sign_type) {
$result = openssl_verify($data, base64_decode($sign), $key, OPENSSL_ALGO_SHA256);
} else {
$result = openssl_verify($data, base64_decode($sign), $key, OPENSSL_ALGO_SHA1);
}
return $result === 1;
}
// Array to xml array('appid' => 'appid', 'code' => 'success')
function array_to_xml($arr)
{
if (!is_array($arr) || empty($arr)) throw new Exception('Array Error');
$xml = "";
foreach ($arr as $key => $val) {
if (is_numeric($val)) {
$xml .= "<" . $key . ">" . $val . "" . $key . ">";
} else {
$xml .= "<" . $key . ">" . $key . ">";
}
}
$xml .= " ";
return $xml;
}
// Xml to array
function xml_to_array($xml)
{
if (!$xml) throw new Exception('XML error');
$old = libxml_disable_entity_loader(true);
// xml解析
$result = (array)simplexml_load_string($xml, null, LIBXML_NOCDATA | LIBXML_COMPACT);
// 恢复旧值
if (FALSE === $old) libxml_disable_entity_loader(false);
return $result;
}
// 逐行读取
function well_import($file)
{
if ($handle = fopen($file, 'r')) {
while (!feof($handle)) {
yield trim(fgets($handle));
}
fclose($handle);
}
}
// 计算总行数
function well_import_total($file, $key = 'well_import_total')
{
static $cache = array();
if (isset($cache[$key])) return $cache[$key];
$count = cache_get($key);
if (NULL === $count) {
$count = 0;
$globs = well_import($file);
while ($globs->valid()) {
++$count;
$globs->next(); // 指向下一个
}
$count and cache_set($key, $count, 300);
}
return $cache[$key] = $count;
}
$g_dir_file = FALSE;
function well_search_dir($path)
{
global $g_dir_file;
FALSE === $g_dir_file and $g_dir_file = array();
if (is_dir($path)) {
$paths = scandir($path);
foreach ($paths as $val) {
$sub_path = $path . '/' . $val;
if ('.' == $val || '..' == $val) {
continue;
} else if (is_dir($sub_path)) {
well_search_dir($sub_path);
} else {
$g_dir_file[] = $sub_path;
}
}
}
return $g_dir_file;
}
?>笔记本电脑更换CPU之图文教程-理论上支持所有型号 你的位置:
首页 > 运维笔记 > 笔记本电脑更换CPU之图文教程-理论上支持所有型号 本文章资源来源于【百度贴吧】的“希望”用户、【SMX】的D大以及【神舟官网】。
本文章理论上支持所有品牌和型号的笔记本电脑,我在这里只是给大家提供一个思路或者参考。
本文章以神舟战神K670D-G4D1 为例。
一、准备工作:
① 首先分辨自己笔记本的主板型号、BIOS当前版本和CPU信息,可以使用CPU-Z 这个工具来检测,如下图所示:
② 上图红框1 为主板的制造商和型号,红框2 为BIOS版本和日期,红框3 为CPU型号,红框4 为CPU插槽类型;
③ 接着去搜索引擎查询你的CPU参数,如红框5 所示,热耗为54W,那么可以判断你将要升级的CPU热耗范围应在54W~75W之间,超出范围会导致蓝屏频繁或无法开机等情况;
④ 然后去CPU性能天梯图(点我直达)那里查询你的主板最高支持哪些CPU,并且注意一点,你将要升级的CPU必须与你红框4 的插槽类型一致,否则无法置入主板内;然后就可以去网购平台查询对应的价格并加入购物车,等BIOS更新成功后就可以付款了;国产笔记本为了降低成本,一般都采用台式CPU,也就是说台式电脑的CPU可以直接用在笔记本的主板上面去;
⑤ 更新BIOS有2个方法:1、先去自己笔记本的官网下载最新的BIOS(点我直达);2、再去下载D大的魔改BIOS(点我直达);两者区别很大,前者为官方稳定版,优点是非常稳定,缺点是你想要的功能几乎都不会有;后者为官方稳定版的修改版,优点是可以提升系统性能、CPU和内存超频以及支持新系统上使用各种旧型号的硬件设备等,缺点是一定概率上会更新失败;为了以备后患,所以我先刷魔改版,失败了还能随时刷回官方的稳定版;
二、刷入新的BIOS
① BIOS更新工具为中文便携版,在电脑桌面就能进行,但为了以防万一,我建议大家还是进入系统的安全模式下进行,如下图所示;
② 刷机工具如下图所示来进行操作即可,这里就不啰嗦了;
③ 由于更新BIOS是一件非常严谨的事情,所以这个过程我没有去截图,我以口头方式来描述一下它的大概流程吧:刷机工具内运行红框7 后,电脑会自动进入CMD模式去解锁BIOS,大概十几秒就结束了,按下回车键就可以退出;接着运行红框8 ,也是十几秒就结束了,按下回车键就可以退出,这个操作会在刷机工具内产生一个“Backup.bin ”的文件,这是你当前的BIOS版本,它是为了预防你刷魔改版或者官网稳定版后出现各种问题后的一个挽救措施;最后运行红框9 ,耗时大概六七分钟,期间电脑风扇会狂响,不管更新是否成功,电脑都会自动重启;如果,如果你的电脑没有自动重启,请在运行红框9 后的10分钟左右,手动重启电脑(即键盘右上角的电源开机键长按关机,再开机);重启后,如果更新失败,你电脑的LOGO不会有任何改变!如果更新成功,你电脑的LOGO会变成CLEVO 字样,如下图所示;
④ 只要BIOS更新成功,都可以成功进入电脑桌面的,然后用CPU-Z工具再次检测一下,你就会发现BIOS的版本已经不一样了,如下图所示;
三、更换CPU
① 更换CPU的同时,必须更换散热硅脂和屏蔽胶带,才能起到良好的散热效果,常用的硅脂有7921、液态金属硅脂和高导热硅脂片,按需选购就行,我用的是最便宜的7921;至于CPU,有钱就买盒装,穷人就买全新散片或者二手拆机的,我买的是二手拆机,哈~~~;至于屏蔽胶带有2种:1、一块钱包邮的金手指耐高温胶带,金黄色,可以随意剪裁;2、十几块包邮的屏蔽贴,也叫CPU护舒宝,省心省力,直接贴上就能用;我为了省钱,买了一块钱包邮的金手指耐高温胶带和2根家里用的木质牙签、剪刀、放大镜,花了差不多一个小时才屏蔽好针脚,眼睛几乎瞎掉。。。
② CPU、硅脂、屏蔽贴到货后就可以拆机更换了,笔记本拆机很简单的,网上都有各种拆机教程和视频,看多几遍就懂了。对了,这里要注重说明一下 :自己的笔记本如果出厂就是7代以下,换8、9代的CPU时候,强烈建议屏蔽针脚后再放入主板内!如果没有屏蔽针脚,开机后会自动烧断针脚,烧断针脚不会影响你的电脑正常开机,只是你购买的CPU从此失去保修和退换服务罢了,仅此而已! 屏蔽针脚的方法,如下图所示;
③ 更换好CPU和硅脂后,请不要急着开机,务必先把内存条旁边的圆形纽扣电池拔除1分钟后,再装回去,可以让你一次点亮屏幕的成功率立马提升90%,不要问我为什么,告诉我的大佬没有跟我解释,所以我也不能告诉你为啥要这样做?!所以,请照做!
④ 上面的步骤都搞完了,不要急着装回后盖,找个方形的纸皮箱先垫着笔记本来开机,免得无法点亮屏幕的时候,还要再拆机检查一次,费时费力!成功进入电脑桌面后,99%的概率,你会发现电脑桌面的图标超级大,反正看着特难受,那是因为更换带集显的CPU后,都会自动卸载原来的显卡驱动和声卡驱动,请使用驱动精灵或者鲁大师之类的工具,把驱动装回去。这里也得多嘴说一句: 并非最新驱动才是最好的,最适合你的才是最好的!这话的意思是,适合你的显卡驱动,正常待机温度时候,CPU和主板温度应≤45度,显卡和硬盘温度应≤35度;游戏时候的温度,比如玩黑悟空这种大型游戏,CPU和主板温度应≤70度,显卡和硬盘温度应≤60度,否则你会发现蓝屏变成家常便饭,让你极度崩溃! 事例: 我刚换CPU的时候,装的就是最新版的显卡驱动,然后发现待机时候(待机就是电脑开机后半小时内啥都不干,纯发呆的看着电脑),CPU和主板温度一直≥65度,显卡和硬盘温度一直≥50度,玩 黑色行动6不到10分钟,电脑高温的提示音就疯狂长鸣,等我切换到桌面查看温度时候,吓死我了,显卡温度已经飙升到86度,主板温度飙升到92度,还没等我关闭游戏,电脑直接蓝屏去了。。。我去!经过不懈努力,各种版本尝试,花了四五个小时,才找到一个最适合我的显卡驱动,待机温度非常完美,如下图所示;