
php
ISaiSai
这个作者很懒,什么都没留下…
展开
-
PHP include_once 与include require_once 与 require
include_once:包含外部文件,当发现已经yiny转载 2014-09-11 10:15:05 · 782 阅读 · 0 评论 -
php 判断字符串是否包含
可以通过 stristr 或者strstr 来判断两个字符串是否包含stristr 不区分大小写strstr 大小写敏感如果不包含,则返回的是布尔类型如果包含,返回的是字符串类型,php $result_i = stristr("abcd","B")?"has char":"no char"; echo($result_原创 2015-07-24 16:32:00 · 1268 阅读 · 0 评论 -
php 面向对象学习
__construct 是构造函数php class HelloWorldClass{ public function __construct($name) { $this->name =$name; } function sayHello() { echo("hel原创 2015-07-24 15:30:36 · 541 阅读 · 0 评论 -
php array与object 相互转化
array 到 object 强制转化object 到 array 循环转化php $aa=(Object)array("abc"=>"123","def"=>"456"); echo($aa->def); foreach($aa as $key=>$value) { $newArray[$key] = $value; } v原创 2015-07-24 14:59:05 · 4764 阅读 · 0 评论 -
php null 空字符串与 0
php 中 ""== 0== null但是if(0) if(“”) if(null) 都是假html>head> meta charset="UTF-8">head>body>php $aa = null; $bb ="" ; $cc =0; if($aa==$bb)原创 2015-07-23 15:32:29 · 1197 阅读 · 0 评论 -
php 清除前面的输出
如下代码只会输出 bb主要用在hack 的地方,框架输出了部分代码需要删除掉php ob_start(); echo "aa"; ob_end_clean(); echo "bb"; ?>转载 2015-07-31 13:54:24 · 7693 阅读 · 1 评论 -
PHP json_decode的坑 仅仅支持utf-8编码的字符,gbk编码会返回null
php json_decode 仅仅支持utf-8编码的字符,gbk编码会返回nullThis function only works with UTF-8 encoded data.参考文档:http://php.net/json_decode/转载 2015-07-30 10:57:31 · 1594 阅读 · 0 评论 -
php trim 学习
1.php 也有trim 可以提出前后的空白 trim(" cc ") 返回 cc2.也可以trim特定字符trim("XXXccXX","X")返回cc另外php 的字符串连接符 是点 . 不是加号 + 如果使用加号连接两个字符串 则返回0原创 2015-04-13 17:30:04 · 697 阅读 · 0 评论 -
php 使用 preg_replace 一次替换多个值
1.php 的 preg_replace 与 str_replace 都是默认 /g 的,全部替换2.如果需要使用正则表达式 需要使用preg_replace$a = "abc defabcd ef";$b= preg_replace("/\t|a/","",$a);echo($b);?>另外对比一下nodejs 的repla原创 2015-03-31 11:01:47 · 4916 阅读 · 0 评论 -
PHP 判断函数是否存在
主要是为了丰富知识线:function_exists if (!function_exists('sayHello')) { function sayHello($userName){ echo("hehe ". $userName); } }转载 2015-01-27 17:05:06 · 648 阅读 · 0 评论 -
apache AddOutputFilter html 支持Include
apache include ssi 配置不生效原创 2016-04-06 11:43:10 · 2047 阅读 · 0 评论