使用Nativefier将网址打包为桌面应用程序
1、打开NPM官网https://nodejs.org/en/download/下载并安装NPM。
2、安装Nativefier
npm install nativefier -g
3.1、打包网址,使用命令行,执行以下命令
nativefier "https://cwlog.net"
3.2、指定应用名打包网址,使用命令行,执行以下命令
nativefier --name "Cwlog" "https://cwlog.net"
1、打开NPM官网https://nodejs.org/en/download/下载并安装NPM。
2、安装Nativefier
npm install nativefier -g
3.1、打包网址,使用命令行,执行以下命令
nativefier "https://cwlog.net"
3.2、指定应用名打包网址,使用命令行,执行以下命令
nativefier --name "Cwlog" "https://cwlog.net"
使用终端执行以下命令
defaults write com.apple.desktopservices DSDontWriteNetworkStores true
制作自动安装Appx的自解压时遇到的问题,.ps1
文件无法直接运行,就想到可以用cmd
调用.ps1
文件,测试显示无法执行。
查询后发现可以直接执行PowerShell
命令,这么写反而省事了。
powershell -command "PowerShell命令"
//在命令提示符控制台执行或批处理文件中写
换过显卡的A1286安装Windows10后遇到的问题,联网自动安装显卡驱动后系统死机重启,进入安全模式卸载显卡驱动后恢复正常,但系统会再次自动安装。
按Win
+R
打开运行,输入gpedit.msc
打开组策略编辑器
从左侧依次打开:计算机配置 -> 管理模板 -> Windows 组件 -> Windows 更新(此项双击打开),再从右侧列表中找到Windows更新不包括驱动程序
,双击打开,选择"已启用"并确定。
可使用array_merge()
函数或array_merge_recursive()
函数。
两函数用法相同,均为将多个数组作为参数传入,如:array_merge($arr1, $arr2, $arr3, $arr4)
。
区别在于array_merge()
函数键值冲突时后面的会覆盖前面的,array_merge_recursive()
函数键值冲突时会将冲突部分合并为新数组。
举个例子:
<?php
$arr1 = ['a'=>1, 'b'=>2];
$arr2 = ['b'=>3, 'c'=>4];
print_r(array_merge($arr1, $arr2));
//结果为:Array([a] => 1 [b] => 3 [c] => 4)
print_r(array_merge_recursive($arr1, $arr2));
//结果为:Array([a] => 1 [b] => Array([0] => 2 [1] => 3) [c] => 4)
print_r(array_merge([0, 1, 2], [0, 1, 2]));
//结果为:Array([0] => 0 [1] => 1 [2] => 2 [3] => 0 [4] => 1 [5] => 2)
break与continue语句均可用于跳出循环,区别在于:
continue跳出本次循环,但此循环语句会继续。
break跳出此循环语句,但外面嵌套(如果有)的循环语句仍然会继续。
举个例子:
<?php
$arr = [0, 1, 2, 3];
foreach($arr as $row){
foreach($arr as $num){
if($num === 2){
break;
}else{
echo $num;
}
}
}
//输出结果为:01010101
foreach($arr as $row){
foreach($arr as $num){
if($num === 2){
continue;
}else{
echo $num;
}
}
}
//输出结果为:013013013013
使用函数如下:ucwords()
:将每个单词首字母转换为大写。ucfirst()
:将第一个单词首字母转为大写。lcfirst()
:将第一个单词首字母转为小写。strtoupper()
:将所有字母转为大写。strtolower()
:将所有字母转为小写。
echo ucwords("hello world");
//Hello World
echo ucfirst("hello world");
//Hello world
echo lcfirst("HELLO WORLD");
//hELLO WORLD
echo strtoupper("hello world");
//HELLO WORLD
echo strtolower("HELLO WORLD");
//hello world
class_exists($className, $autoLoad)
函数可检测类是否存在,参数$className
为类名,需要使用完整命名空间,参数$autoLoad
为是否允许自动加载,非必填,默认为true
,函数返回Bool值。
method_exists($className, $methodName)
函数可检测方法是否存在,参数$className
可以为类名也可以为类的对象,参数$methodName
为要检测的方法名,函数返回Bool值。
property_exists($className, $propertyName)
函数可检测属性是否存在,参数$className
可以为类名也可以为类的对象,参数$propertyName
为要检测的属性名,函数返回Bool值。
使用explode
函数与implode
函数,第一个参数为间隔符号,第二个参数为要打散的字符串。
explode('/', 'a/b/c');
//结果为 array('0'=>'a', '1'=>'b', '2'=>'c');
implode('/', ['a', 'b', 'c'])
//结果为 a/b/c