Loading

邢栋博客

包含关键词“php”的文章

初识php7

初识php7 php7 新特性 变量类型 php7版本函数的参数和返回值增加了类型限定。 加入类型,实际上是为了php7.1版本的JIT特性做准备,增加类型后的php JIT可以正确判断变量类型,生成最佳的机器指令。 JIT:是just in time,即时编译技术,表示运行时将指令转化为二进制机器码。 对于计算机密集型的程序,JIT可以将PHP的OpCode直接转换为机器码,大幅度提升性能,将在php7.1版本带有此特性 function test(int $a,string $b,array $c):int{ //code } 错误异常 php程序出...

linux下memcache以及其php扩展的安装

安装memcache ,先下载 1.首先安装依赖包libevent yum –y install libevent 主包已经安装,别忘记安装libevent-devel,不然./configure过不去 tar xzf /lamp/memcached-1.4.10.tar.gz 解压memcached cd /lamp/memcached-1.4.10 进入 memcached目录 ./configure --prefix=/usr/local/memcache 配置 make && make install 编译与安装 userad...

php驼峰字符串转换成下划线样式

<?php $str = 'OpenAPI'; //方法1 // $length = mbstrlen($str); // $new = ''; // for($i = 0; $i < $length; $i++) // { // $num = ord($str[$i]); // $pre = ord($str[$i - 1]); // $new .= ($i != 0 && ($num >= 65 && $num <= 90) && ($pre >= ...

php实现数字转为汉字金额(转)

<?php header("Content-type:text/html;charset=utf-8"); /** 数字转换为中文 @param string|integer|float $num 目标数字 @param integer $mode 模式[true:金额(默认),false:普通数字表示] @param boolean $sim 使用小写(默认) @return string */ function number2chinese($num,$mode= true,$sim= true){ if(!i...

windows下php安装扩展pthreads实现php多线程

一、下载pthreads扩展 下载地址:http://windows.php.net/downloads/pecl/releases/pthreads 我下载的是php_pthreads-2.0.9-5.5-ts-vc11-x64.zip //5.5对应的是php版本,64位是系统位数 二、安装pthreads扩展 复制php_pthreads.dll 到目录 bin\php\ext\ 下面。(D:\wamp\bin\php\php5.5.12\ext) 复制pthreadVC2.dll 到目录 bin\php\ 下面。(D:\wamp\bin\php\...

php计算二维数组中某个key的集合

$array(类似于这个数组) Array ( [0] => Array ( [id] => 3 [name]=>'aaa') [1] => Array ( [id] => 4 [name]=>'bbb') [2] => Array ( [id] => 13 [name]=>'ccc') ); 方法1 $ids = array(); $ids = array_map('array_shift', $array); 方法2(php>=5.5) $ids = array(); $ids = arra...

thinkphp3.2同时支持mysql和mongodb

1.如果只是支持mysql,就不用说了,先说说只支持mongodb吧 在config.php中 <?php return array( //'配置项'=>'配置值' 'DB_TYPE'=>'mongo', 'DB_HOST'=> '127.0.0.1', 'DB_USER'=>'', 'DB_PWD'=>'', 'DB_PORT'=>'27017', 'DB_NAME'=> 'test', 'DB_PREFIX'=> '', ); 新建一个TestModel.class.php文件 <?php ...

mongo的基本操作(包括php的)

db.test.find()<==> select from test db.test.find({'name':'foobar'})<==> select from test where name='foobar' db.test.find({'ID':10}).count()<==> select count() from test where ID=10 db.test.find().skip(10).limit(20)<==> select from test limit 10,20 db.test...

windows下装php的mongodb扩展

windows下装php的mongodb扩展,遇到一个问题 ,折腾了半天 问题:phpinfo中看不到mongo的信息,扩展都已经配置进去,apache重启也没有报错 我的电脑环境是装的wampserver,php版本是5.5.12,X64,我先下载mongodb的安装包mongodb-win32-x86_64-2008plus-ssl-3.0.3-signed.msi(官网可下载到),如日志http://xingdong365.com/network/32.html 已经正常了。 下面需要装扩展文件,找的是对应的版本 php_mongo-1.6.8-5...

php常用魔术方法

 //construct    //构造函数 在一个类中定义一个方法作为构造函数。具有构造函数的类会在每次创建新对象时先调用此方法。如果子类中定义了构造函数则不会隐式调用其父类的构造函数。要执行父类的构造函数,需要在子类的构造函数中调用 parent::construct() 。如果子类没有定义构造函数则会如同一个普通的类方法一样从父类继承(假如没有被定义为 private 的话)。    class Animal{     public function construct() { ...