
PHP
haohappy2
这个作者很懒,什么都没留下…
展开
-
Export CSV UTF-8 BOM
本身的编码是以UTF-8无BOM格式编码的,要在excel中显示要加上BOM $str = "\xEF\xBB\xBF".$str; //添加BOM1.output_csv函数使用前,确保php源码是utf-8,并且无BOM,并且没有输出任何内容 2.这个问题主要针对CSV文件,XLS文件可以通过转换编码实现...原创 2013-12-28 15:24:44 · 443 阅读 · 0 评论 -
PHP get user infomation from window AD
<?php error_reporting(0); $errorMessage = false; $server = 'ldap://192.168.0.11'; $dn = 'dc=next.com';//'CN=Users,DC=next.com,DC=com'; $bind_user = 'patrick@next.com'; $bind_pass = 't...原创 2014-09-02 13:38:09 · 218 阅读 · 0 评论 -
Thinking in PHP
今天也是被突如其来的灵感激发,写一篇PHP相关的感触,也是作为两年多PHP程序员的感触吧。谈到PHP无非就是一些很诙谐的事情,也把被玩坏的PHP这个作为本篇文章的标题。好吧,到这也让今天的文章有些喜感。说了这么多,被玩坏的PHP究竟是什么样呢? 1、PHP是前端语言,JAVA是后台语言。我觉得有几点原因。一是PHP可能比较简单,简单程度和前端语言相似。PHP非常的灵活,便捷。你可能需要的 他都...原创 2016-04-22 14:20:30 · 221 阅读 · 0 评论 -
C-Shell “Variable syntax” problem
“Varible syntax” problem cause the shell can't return the value properly. #!/bin/cshset php_path = '/usr/bin/php'$php_path test.php $argvexit $? when you run this shellsystem("test >...原创 2014-09-16 10:46:25 · 255 阅读 · 0 评论 -
How to pass varaible from shell to PHP correctly
Sometimes, if you want to want to pass the whole "sentence" whcih with blank from shell script to another script which need to deal with the passed value, you will find that, the words has been expl...原创 2014-09-29 09:34:39 · 130 阅读 · 0 评论 -
PHP export text into Excel can't see normal style as former
function change_excel_br($str){ $new_str =""; if($str){ $p_new_lines = array("\r\n", "\n", "\r","\r\n", "<pre>","</pre>","<br&a原创 2016-06-14 10:40:11 · 162 阅读 · 0 评论 -
yum upgrade PHP version
yum是CentOS系统自带的用于方便地添加/删除/更新RPM包的工具,它能自动解决包的倚赖性问题。 用yum更新PHP,只需用一条命令就可以搞定: #yum update php 但问题来了,使用此命令后,系统告诉我,没有发现可更新的包。而当前的PHP版本只是5.2.1,PHP官方已经更新到5.2.6了。 经过一番询问,才知道原来CentOS系统的源里PHP仍旧是5.2.1,需要额外的源才能...原创 2016-08-15 13:17:26 · 261 阅读 · 0 评论 -
Replace of HTML tag
$str=preg_replace("/\s+/", " ", $str); //过滤多余回车$str=preg_replace("/<[ ]+/si","<",$str); //过滤<__("<"号后面带空格) $str=preg_replace("/<\!--.*?-->/si",&q原创 2016-11-16 10:06:00 · 335 阅读 · 0 评论 -
Replace current src and add the host name using Regx in PHP
<?php $content = ' <img alt="" src="/a.jpg/" /> <img alt="" src="b.jpg" /> <img alt="" src="test.php" /> &原创 2015-12-11 14:46:49 · 126 阅读 · 0 评论 -
some problem of bash shell.
character \015 (carrage return) perl -pi.bak -e "s/\r//g;" fileencode.pl After run this command, the issue will be fixed And also find another problem, if you pass one parameters from ...原创 2014-09-01 14:56:46 · 107 阅读 · 0 评论 -
PHP CSV Writer
<?php/** * Simple class to properly output CSV data to clients. PHP 5 has a built * in method to do the same for writing to files (fputcsv()), but many times * going right to the client i...原创 2014-08-15 15:25:55 · 161 阅读 · 0 评论 -
PHP Strpos Function Special Notice
Sometime, when you use strpos, it can't work as you expect, please refer to below: Wrong Way$pos = strpos($str, $status);if($pos!==false){....... ...原创 2013-09-02 18:07:32 · 88 阅读 · 0 评论 -
how to track where invoke the defined function
var_dump(debug_backtrace());var_dump(debug_print_backtrace());原创 2015-01-09 09:44:43 · 108 阅读 · 0 评论 -
Deprecated: Function split() is deprecated Error
本地测试的程序上传到服务器出现很多错误,Deprecated: Function split() is deprecated 查了原因是因为PHP的版本不同所导致的,本身程序开发的时候用的是PHP5.2以下版本,而现在空间上用的是PHP5.3的版本,很多PHP函数已经过时不能用了,这里的这个错误原因就是函数split()在 PHP5.3 中已经不建议使用了。PHP5.3 split() 不建议使...原创 2013-09-11 13:30:56 · 187 阅读 · 0 评论 -
PHP Regex Domain
$str = "http://www.baidu.com/s?ie=utf-8&bs=php+cookie+%E9%BB%98%E8%AE%A4%E6%97%B6%E9%97%B4&f=8&rsv_bp=1&rsv_spt=3&wd=php+session+%E5%AD%98%E5%82%A8%E4%BD%8D%E7%BD%AE&rsv_sug3...原创 2013-09-17 17:52:17 · 107 阅读 · 0 评论 -
PHP interface and abstract
1.php 接口类:interface其实他们的作用很简单,当有很多人一起开发一个项目时,可能都会去调用别人写的一些类,那你就会问,我怎么知道他的某个功能的实现方法是怎么命名的呢,这个时候php接口类就起到作用了,当我们定义了一个接口类时,它里面的方式是下面的子类必须实现的,比如 : 1 interface Shop 2 { 3 public function buy($gi...原创 2013-09-18 11:25:58 · 80 阅读 · 0 评论 -
HTTP Status
常见HTTP状态码200 OK301 Moved Permanently302 Found304 Not Modified307 Temporary Redirect400 Bad Request401 Unauthorized403 Forbidden404 Not Found410 Gone500 Internal Server Error...原创 2013-09-18 11:50:03 · 97 阅读 · 0 评论 -
PHP REGX
"^\d+$" //非负整数(正整数 + 0)"^[0-9]*[1-9][0-9]*$" //正整数"^((-\d+)|(0+))$" //非正整数(负整数 + 0)"^-[0-9]*[1-9..."^\d+$" //非负整数(正整数 + 0) "^[0-9]*[1-9][0-9]*$" //正整数 "^((-\d+)|(0+))$" //非正整数(负整数 +原创 2013-09-18 14:02:23 · 108 阅读 · 0 评论 -
how to count chinese character
<?php$cityname="上海"$pa = '/[\x{4e00}-\x{9fa5}]/siu';preg_match_all($pa, $cityname, $r);$count = count($r[0]);// can't set one wordecho $count;原创 2014-08-02 12:34:42 · 149 阅读 · 0 评论 -
417 error for post big data solution
HTTP/1.1 协议里设计 100 (Continue) HTTP 状态码的的目的是,在客户端发送 Request Message 之前,HTTP/1.1 协议允许客户端先判定服务器是否愿意接受客户端发来的消息主体(基于 Request Headers)。 即, Client 和 Server 在 Post (较大)数据之前,允许双方“握手”,如果匹配上了,Cl...原创 2016-12-29 15:45:59 · 281 阅读 · 0 评论