linux查找文件中一个关键词的所有行写入到新文件中
grep '关键词' source.txt > ./new.txt
grep '关键词' source.txt > ./new.txt
一、描述
Ubuntu新搭建的lnmp环境测试环境是否正常,在网站根目录创建index.php,输出phpinfo,浏览器访问页面为空。
二、原因
原因是nginx无法正确的将 *.php 文件的地址传递给php-fpm去解析, 相当于php-fpm接收到了请求,但这请求却指向一个不存在的文件,于是返回空结果
三、解决
修改fastcgi_params
vim /etc/nginx/fastcgi_params
添加以下参数
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
//基于layui修改弹框消息美化(TP5.0)
function alert($msg='',$url='',$icon='',$time=3){
$str='<script type="text/javascript" src="'.config('admin_static').'/script/js/jquery.min.js"></script><script type="text/javascript" src="'.config('admin_static').'/script/lib/layui/layui.js"></script>';//加载jquery和layui
$str.='<script>$(layui.use(\'layer\', function(){layer.msg("'.$msg.'",{icon:'.$icon.',time:'.($time*1000).'}, function(){location.href="'.$url.'"})}));</script>';//主要方法
return $str;
}
//tp5.1(2019.5.27)
function alert($msg='',$url='',$icon='',$time=3){
$str='<script type="text/javascript" src="/static/jquery.min.js"></script><script type="text/javascript" src="/static/admin/layui/layui.js"></script>';//加载jquery和layui
$str.='<script>$(layui.use(\'layer\', function(){layer.msg("'.$msg.'",{icon:'.$icon.',time:'.($time*1000).'}, function(){location.href="'.$url.'"})}));</script>';//主要方法
return $str;
}
<?php
static public function unlimitedForLevel($cate,$html='|—',$pid=0,$level=0){
//建立空数组存储结果
$arr = array();
//循环$cate,如果这级的pid等于上一级的cid,就先压入数组,再找当前的下一级
foreach ($cate as $v) {
//查找当前分类是否有子分类
if ($v['parent_id'] == $pid) {
$v['level'] = $level + 1;
$v['html'] = str_repeat($html, $level);
$arr[] = $v;
//递归合并数组
$arr = array_merge($arr,self::unlimitedForLevel($cate,$html,$v['id'],$level+1));
}
}
return $arr;
}
//静态方法获取多维数组递归结果
static public function unlimitedForMore($cate,$name='child',$pid=0){
$arr = array();
foreach ($cate as $v) {
if ($v['parent_id'] == $pid) {
$v[$name] = self::unlimitedForMore($cate,$name,$v['id']);
$arr[] = $v;
}
}
return $arr;
}
//递归获取父函数
static public function getParents($cate,$cid){
$arr = array();
foreach ($cate as $v) {
if ($v['id'] == $cid) {
$arr[] = $v;
$arr = array_merge(self::getParents($cate,$v['parent_id']),$arr);
}
}
return $arr;
}
?>
在使用layui表单验证的时候遇到这么个问题,用layui自带的 lay-verify 验证手机或者邮箱的时候,如果该字段在空的情况下提交也会提示手机或者邮箱格式不正确,我想要的效果是用户可以不填,如果填的话才进行手机或者邮箱验证
[root@localhost ~]# tzselect
Please identify a location so that time zone rules can be set correctly.
Please select a continent or ocean.
1) Africa
2) Americas
3) Antarctica
4) Arctic Ocean
5) Asia
6) Atlantic Ocean
7) Australia
8) Europe
9) Indian Ocean
10) Pacific Ocean
11) none - I want to specify the time zone using the Posix TZ format.
#? 5
Please select a country.
1) Afghanistan 18) Israel 35) Palestine
2) Armenia 19) Japan 36) Philippines
3) Azerbaijan 20) Jordan 37) Qatar
4) Bahrain 21) Kazakhstan 38) Russia
5) Bangladesh 22) Korea (North) 39) Saudi Arabia
6) Bhutan 23) Korea (South) 40) Singapore
7) Brunei 24) Kuwait 41) Sri Lanka
8) Cambodia 25) Kyrgyzstan 42) Syria
9) China 26) Laos 43) Taiwan
10) Cyprus 27) Lebanon 44) Tajikistan
11) East Timor 28) Macau 45) Thailand
12) Georgia 29) Malaysia 46) Turkmenistan
13) Hong Kong 30) Mongolia 47) United Arab Emirates
14) India 31) Myanmar (Burma) 48) Uzbekistan
15) Indonesia 32) Nepal 49) Vietnam
16) Iran 33) Oman 50) Yemen
17) Iraq 34) Pakistan
#? 9
Please select one of the following time zone regions.
1) east China - Beijing, Guangdong, Shanghai, etc.
2) Heilongjiang (except Mohe), Jilin
3) central China - Sichuan, Yunnan, Guangxi, Shaanxi, Guizhou, etc.
4) most of Tibet & Xinjiang
5) west Tibet & Xinjiang
#? 1
The following information has been given:
China
east China - Beijing, Guangdong, Shanghai, etc.
Therefore TZ='Asia/Shanghai' will be used.
Local time is now: Tue Jul 19 22:05:59 CST 2016.
Universal Time is now: Tue Jul 19 14:05:59 UTC 2016.
Is the above information OK?
1) Yes
2) No
#? yes
Please enter 1 for Yes, or 2 for No.
#? 1
You can make this change permanent for yourself by appending the line
TZ='Asia/Shanghai'; export TZ
to the file '.profile' in your home directory; then log out and log in again.
Here is that TZ value again, this time on standard output so that you
can use the /usr/bin/tzselect command in shell scripts:
Asia/Shanghai
source /etc/profile
新版本的谷歌浏览器,会对 .dev 或者 .app 后缀的域名,在访问时强制跳转至https访问。
比如:你在谷歌浏览器中,访问 www.blog.dev 或者http://www.blog.dev 地址后,会强制跳转为 https://www.blog.dev。
对于做 web 开发的人员来说,开发环境的服务器一般默认都是遵循 http 协议的,而不是 https 协议。这样,就导致我们无法用谷歌浏览器(新版QQ,360等浏览器都有这问题)进行测试。
Linux常见英文报错中文翻译(菜鸟必知)
1.command not found 命令没有找到
2.No such file or directory 没有这个文件或目录
3.Permission denied 权限不足
4.No space left on device 磁盘没有剩余空间
5.File exists 文件已经存在
6.Is a directory 这是1个目录
7.Not a directory 不是1个目录
8.Warning: Changing a readonly file 警告:改变一个只读文件
9.Found a swap file by the name ".1.swp" 发下了一个swap文件名字为1.swp
(vim编辑器碰到的意外关闭文件有缓存文件)
10.unrecognized option '--oldboy' 不识别的选项,去查看帮助
11.No route to host 没有路由到主机(防火墙没关)
12.connection refused 连接拒绝(防火墙没关或服务端口没开)
13.Access denied 访问拒绝(权限或者selinux)
转自:CSDN
字符串类型(string),散列类型(hash),列表类型(list),集合类型(set),有序集合类型(zset)
KEYS * 获得当前数据库的所有键
EXISTS key [key ...] 判断键是否存在,返回个数,如果key有一样的也是叠加数
DEL key [key ...] 删除键,返回删除的个数
TYPE key 获取减值的数据类型(string,hash,list,set,zset)
FLUSHALL 清空所有数据库
CONFIG [get、set] redis配置
-inf 负无穷
+inf正无穷