有这样的用法哦

 $allow_state_array_invoc = array('store_invoice','invoiceno','invoicerec','invoiceing');
if (in_array($_GET['state'],$allow_state_array_invoc)) { $condition['invoice_state'] = str_replace($allow_state_array_invoc,
array('0','1','2','3'), $_GET['state']); }
else{
$_GET['state'] = 'store_invoice';
$condition['invoice_state'] = 0 ;
}

O(∩_∩)O哈哈哈~很懒

php in_array 和 str_replace的更多相关文章

  1. 简单管理员权限与几个常用的PHP 常用函数,in_array(),explode(),implode(),join(),str_replace()

    先把今天要用的几个函数罗列出来: //explode()转换成数组,implode()转化成字符串 explode("分隔符",需要被分割的字符串或变量) $priv=" ...

  2. Warning: in_array() expects parameter 2 to be array, string given in D:\wamp\www\suiji.php on line 26

    可参考上篇文章  链接 PHP数组简写模式 同样是PHP版本问题:in_array()函数 第二个参数应该为数组 但是 lnmp下,PHP5.3不报错,wamp下PHP5.5报以下错误: echo & ...

  3. in_array,array_search的使用

    写一个数组里面有小写a-z 大写A-Z 以及数字,把相似的数字和字母都剔除     无论大小写:将括号内的数字剔除(0,o,2,Z,1,i) $arr1 = range("a", ...

  4. clang 简单的str_replace实现

    自己写的一段: //gool char* str_replace(char* source, const char* find, const char* replace){ if (source == ...

  5. strtr和str_replace字符替换函数

    (一)strtr是字符替换函数 (1)单个字符替换: <?php echo strtr("abba", "ab", "10"),&qu ...

  6. str_replace vs preg_replace

    转自:http://benchmarks.ro/2011/02/str_replace-vs-preg_replace/ 事实证明str_replace确实比preg_replace快. If you ...

  7. in_array支持第三个参数,强制对数据类型检测

    in_array函数是判断数据中是否存在指定的内容了,对于这个函数用法非常的简单但在使用过程中会我发现有一些问题. 先介绍一下需求背景: 发票方式: 0=捐赠(不要问我为什么,历史原因) 1=对中寄送 ...

  8. str_replace() 用法bug和技巧

    语法 str_replace(find,replace,string,count) 参数 描述 find 必需.规定要查找的值. replace 必需.规定替换 find 中的值的值. string ...

  9. 怎么在php里面利用str_replace防注入

    <php    /**    * 安全过滤函数    *    * @param $string    * @return string    */    function safe_repla ...

随机推荐

  1. 火狐浏览器,hostadmin hosts文件访问权限不足

    开始->附件->以管理员身份运行. cacls %windir%\system32\drivers\etc\hosts /E /G Users:W

  2. Django中文无法转换成latin-1编码的解决方案

    在Ubuntu上用Django做Web开发的时候遇到了中文保存到Cookie无法解析的问题,经过了下面几个步骤终于把问题解决了: 修改/usr/lib/python3.4/wsgiref/header ...

  3. project euler 26:Reciprocal cycles

    A unit fraction contains 1 in the numerator. The decimal representation of the unit fractions with d ...

  4. visual studio 2008安装报错问题处理

    今天刚入职,安装visual studio 2008时报错说web创建组件安装错误,后来发现是因为之前这电脑安装visual studio 2008的时候是office2007刚安装的版本,可是后来系 ...

  5. C51单片机模拟I2C总线驱动程序设计

    /********************************** I2C总线驱动 ******************************** 模块名:I2C总线驱动 型号:I2C 功能描述 ...

  6. Unix/Linux环境C编程入门教程(38) shell命令进阶演示

     1.w命令 该命令也可以查看登录当前系统的用户信息.与who命令相比,w命令的功能更强大,它不但可以显示当前有哪些用户登录到系统,还可以显示这些用户正在进行的操作,并给出更加详细和科学的统计数据 ...

  7. IA32与x86

    64位机器相比于32位优点 ①访问虚拟地址范围更大 ②更多的寄存器 ③过程较简单 ④采用条件传送指令 详细看:http://baike.baidu.com/link?url=DoRp7iW_z3cE6 ...

  8. N-Queens 解答

    Question The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no tw ...

  9. LeeCode-Delete Node in a Linked List

    Write a function to delete a node (except the tail) in a singly linked list, given only access to th ...

  10. 【转】android camera(一):camera模组CMM介绍

    关键词:android  camera CMM 模组 camera参数平台信息:内核:linux系统:android 平台:S5PV310(samsung exynos 4210)  作者:xubin ...