Home > Backend Development > PHP Tutorial > 易搅混php函数

易搅混php函数

WBOY
Release: 2016-06-13 13:16:51
Original
774 people have browsed it

易混淆php函数
addcslashes($str,'m');   在指定字符前转义     stripcslashes($str) 去掉此函数的转义
addslashes(string)       预定义转义           stripslashes        去掉此函数的转义      


变量没有出现 isset=false empty=true

implode array->str
emplode str->array

array_key_exists($key,array) $key是否在array的key中
in_array($value,array)      $value是否在array的value中


ob_start() 打开缓冲区
ob_get_contents()  返回缓冲区内容
ob_end_clean()  清空缓冲区并且关闭缓冲

测试代码:

ob_start();
echo “ob_start之后的内容不会输出<br/> “;
$out = ob_get_contents();
ob_end_clean();
echo “ob_end_clean之后的内容输出<br/>”;
echo $out;
Copy after login


上面输出结果:
ob_end_clean之后的内容输出
ob_start之后的内容不会输出
Copy after login


urlencode 编码url为%16进制
urldecode 解码url

定界符

constant() 支持可变常量
定义一个大小写不敏感的常量:
<?php
     define("GREETING","Hello world!",TRUE);
     echo constant("greeting");
?>
Copy after login


const 与define
define不能定义在类中,而const必须定义在类中,并且const必须通过类名::变量名来进行访问;常量名前不要使用”$” 建议大写
class Person{
    const COUNTRY="china";
}
echo Person::COUNTRY;
Copy after login

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template