随笔分类 -  PHP

phar文件的使用
摘要:1.用php命令行php phar文件2.生成bat文件,在命令行下使用,以composer.phar为例 ( 1)在php.exe所在目录新建composer.bat文件 (2)把composer.phar移动到php.exe所在目录 (3)在php.exe所在目录打开命令行窗口执行echo @p... 阅读全文

posted @ 2015-08-08 00:59 左小兵 阅读(1431) 评论(0) 推荐(0)

windows下安装Composer
摘要:1.下载https://getcomposer.org/composer.phar2.复制到php.exe所在目录3.在php.exe所在目录新建composer.bat文件4.打开cmd,跳转到php.exe所在目录,运行echo @php "%~dp0composer.phar" %*>comp... 阅读全文

posted @ 2015-08-07 00:39 左小兵 阅读(278) 评论(0) 推荐(0)

zend guard6的使用
摘要:1.生成key edit->preferences->license Keys->generate 2.新建product license文件 3.新建Zend Guard项目文件 需要注意新建项目的第二项需要英文路径 4.在项目上按右键 选择configure 初始界面是 如果要用做授权,点击security按键 然后设置license文件等 附上php.in... 阅读全文

posted @ 2014-05-17 14:23 左小兵 阅读(451) 评论(0) 推荐(0)

获得图片颜色---摘自php手册
摘要:Example #1 imagecolorsforindex() 例子 ';print_r($color_tran);echo'';?> 本例将输出: Array( [red] => 226 [green] => 222 [blue] => 252 ... 阅读全文

posted @ 2014-05-13 10:53 左小兵 阅读(187) 评论(0) 推荐(0)

ob_start()失效与phpunit的非正常结束
摘要:在ob_clean();或ob_get_clean()之前有return或致命错误,从而结束了程序,会导致ob_start失效,这和phpunit的非正常结束 阅读全文

posted @ 2014-05-12 22:38 左小兵 阅读(400) 评论(0) 推荐(0)

让网站可以从根目录访问,但仍然可以放在一个文件夹里的方法
摘要:建一个index.php文件放在根目录下然后加载文件夹下的index.php文件(当然也可以是其他的文件)这和访问文件夹目录下index.php文件效果是一样的 阅读全文

posted @ 2014-05-06 11:35 左小兵 阅读(265) 评论(0) 推荐(0)

semat内核阿尔法的状态图
摘要: 阅读全文

posted @ 2014-04-29 07:36 左小兵 阅读(257) 评论(0) 推荐(0)

万能写入sql语句,并且防注入
摘要:通过perpare()方法和检查字段防sql注入.$pdo=new PDO('mysql:host=localhost;dbname=scms', 'root' );$_POST=array('title'=>23,'content'=>'kmm');$keys= array_keys($_POST... 阅读全文

posted @ 2014-04-29 07:16 左小兵 阅读(1321) 评论(0) 推荐(0)

pdo的工作方式与查错
摘要:pdo某些方法如prepare()会返回PDOStatement对象;然后需要通过返回的PDOStatement对象的方法操作当查错通过$pdo->errInfo()方法可能查不出错误信息应该通过$PDOStatement->errInfo()方法查错误信息 阅读全文

posted @ 2014-04-24 20:46 左小兵 阅读(173) 评论(0) 推荐(0)

php pdo错误:SQLSTATE[HY093]: Invalid parameter number: parameter was not defined
摘要:原因:在使用execute()执行时没有传对应prepare()设置的参数 阅读全文

posted @ 2014-04-24 00:17 左小兵 阅读(10406) 评论(0) 推荐(0)

简单应用控制器的时序图
摘要: 阅读全文

posted @ 2014-04-23 02:32 左小兵 阅读(248) 评论(0) 推荐(0)

SPL迭代器的工作和代理模式OuterIterator
摘要:1.迭代器通过foreach语言结构来实现迭代,没有实现迭代器接口(Iterator)的普通对象使用foreach结构会遍历公共属性.2.OuterIterator用于做为实际迭代器的代理(即代理模式)3.OuterIterator有RecursiveIteratorIterator(平面化多维结构... 阅读全文

posted @ 2014-04-21 02:50 左小兵 阅读(331) 评论(0) 推荐(0)

递归遍历目录的迭代器方式
摘要:getDepth()); if ($file->isDir()) { echo DIRECTORY_SEPARATOR; } echo $file->getBasename(); if ($file->isFile()) { echo " (" .$file->getSize()... 阅读全文

posted @ 2014-04-21 02:07 左小兵 阅读(338) 评论(0) 推荐(0)

递归遍历多维数组(树数据结构)的超级简单方式,并且可以递归超过200层,摘自<<PHP精粹:编写高效PHP代码>>
摘要:$value) { echo "Depth: " . $recursiveIteratorIterator->getDepth() . PHP_EOL; echo "Key: " . $key . PHP_EOL; echo "Value: " .$value . PHP_EOL;}?> 阅读全文

posted @ 2014-04-18 12:36 左小兵 阅读(654) 评论(0) 推荐(0)

http协议传输二进制数据以及对输入流(php://input)和http请求的理解
摘要:1.index.php array( 'method' => 'POST', 'header' => "Content-type: application/x-www-form-urlencoded\r\n" ... 阅读全文

posted @ 2014-04-18 12:10 左小兵 阅读(601) 评论(0) 推荐(0)

一个非常简单的RPC服务
摘要:1.servicefunctions.phpView Code2.index.phpView Code 阅读全文

posted @ 2014-04-18 03:46 左小兵 阅读(156) 评论(0) 推荐(0)

php://input 打开的数据流只能读取一次,即读取一次之后读取的值为空
摘要:如题 阅读全文

posted @ 2014-04-18 00:03 左小兵 阅读(425) 评论(0) 推荐(0)

soap的简单实现(PHP)
摘要:1.非wsdl模式(1)函数文件testphp/ServiceFunctions.class.phpView Code(2)服务端文件testphp/soapserver.php'http://localhost');$server=new SoapServer(null,$options);$se... 阅读全文

posted @ 2014-04-15 23:36 左小兵 阅读(395) 评论(0) 推荐(0)

使用PHP的curl扩展实现跨域post请求,以及file_get_contents()百度短网址例子
摘要:'http://www.cnblogs.com/zuoxiaobing/');curl_setopt($ch,CURLOPT_POSTFIELDS,$data);$strRes=curl_exec($ch);curl_close($ch);$arrResponse=json_decode($strR... 阅读全文

posted @ 2014-04-15 16:58 左小兵 阅读(1814) 评论(0) 推荐(0)

将HTML标签转化为实体使用函数htmlentities
摘要:如题 阅读全文

posted @ 2014-04-07 03:54 左小兵 阅读(345) 评论(0) 推荐(0)

导航