其实也可以检查其他语言的语法错误,把代码内的php -l 换了就行
公司主营业务:网站建设、成都做网站、移动网站开发等业务。帮助企业客户真正实现互联网宣传,提高企业的竞争能力。创新互联是一支青春激扬、勤奋敬业、活力青春激扬、勤奋敬业、活力澎湃、和谐高效的团队。公司秉承以“开放、自由、严谨、自律”为核心的企业文化,感谢他们对我们的高要求,感谢他们从不同领域给我们带来的挑战,让我们激情的团队有机会用头脑与智慧不断的给客户带来惊喜。创新互联推出新安免费做网站回馈大家。
#! /bin/bash # # check_php_syntax.sh # Copyright (C) 2014 <http://superfly81.blog.51cto.com/> # # Distributed under terms of the MIT license. # #!/bin/bash # check php syntax if [ $# -lt 1 ];then echo 'Usage: ' $0 'directory'; exit fi if [ ! -d $1 ];then echo $1 'not a directory,please check!'; exit fi directory=$1 echo $directory temp_file="/tmp/file$$" echo $temp_file ls -R $directory | awk ' BEGIN{ FS="n" folder="'$directory'" logname="'$temp_file'" temp="" } { if($0~/.php$/){ system("php -l " folder "/" $0 " >> " logname " 2>&1") } if($0~/:$/){ temp=substr($0,1,length($0)-1) folder=temp } } ' #folder=substr($1,1,length($1)-1) if [ -e $temp_file ];then cat $temp_file | awk ' BEGIN{ error = 0 } { if($0~/Parse/) { error++ errorfile[$0] = $0 } } END{ print "错误文件:" error "个" if(length(errorfile)>0) print "错误行数:" for (i in errorfile) print i } ' else echo "php file not found." exit; fi
网页标题:检查整个目录php语法错误脚本
URL网址:https://www.cdcxhl.com/article10/geppdo.html
成都网站建设公司_创新互联,为您提供网站排名、ChatGPT、标签优化、静态网站、网站建设、云服务器
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联