显示标签为“error”的博文。显示所有博文
显示标签为“error”的博文。显示所有博文

2013年4月14日星期日

php5.3 开始出现的 Function ereg() is deprecated Error 问题解决办法



PHP 5.3 ereg() 无法正常使用,提示“Function ereg() is deprecated Error”。问题根源是php中有两种正则表示方法,一个是posix,一个是perl,php6打算废除posix的正则表示方法所以后来就加了个preg_match。此问题解决办法很简单,在ereg前加个过滤提示信息符号即可:把ereg()变成@ereg()。这样屏蔽了提示信息,但根本问题还是没有解决,php在5.2版本以前ereg都使用正常,在5.3以后,就要用preg_match来代替ereg。所以就需要变成这样,原来:ereg(“^[0-9]*$”,$page)变成:preg_match(“/^[0-9]*$/”,$page)特别提醒:posix与perl的很明显的表达区别就是是否加斜杠,所以与ereg相比,后者在正则的前后分别增加了两个”/”符号,不能缺少。

Tips:此问题在php5.2之前版本不会出现。

2013年4月12日星期五

git 常见操作出错及解决方法汇总(持继更新,欢迎投稿)


1. Q: git push 
error: refusing to update checked out branch: refs/heads/master
A: You can simply convert your remote repository to bare repository ( There is no working copy in the bare repository - the folder contains only the actual repository data ) .

Execute following command in your remote repository folder:

git config --bool core.bare true
Then delete all the files except .git in that folder. and then you will be able to perform git push to the remote repository without any errors.

2. Q: Git Tip: git push  'No refs in common and none specified'
Git is a source-control tool used by software developers.
A: $ git push origin master