php多态
发表于|更新于|php
通过接口
A有B和C两个实现,但是起实现方法是不同的,这就是PHP多态
文章作者: developer
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源 Dev!
相关推荐
2018-07-11
php 使用 compser 安装一个自己的类库
安装方法很多,给出fork别人的类 开源代码在自己的根目录composer.json中增加两个东西 别人类库中的composer.json中的name是包名,加到require字段 增加一个repositories字段,写法如下实例 执行composer update即可安装完毕 123456"repositories": [ { "type": "vcs", "url": "https://github.com/1291061979/php_sdk" }]
2019-03-04
thinkphp beego swoft yaf 性能测试 压力测试 php go swoole 速度对比 helloworld
1ab -n 10000 -c 200 测试机为腾讯云1核1G普通云硬盘,如果用ssd的话php成绩会有所提升 输出内容为时间戳 beego swoft的性能都强的不得了,在同一级别,裸跑性能都逼近nginx处理静态文件nginx转发损耗很大,由于nginx转发会导致thinkphp,swoft,beego的性能几乎一样。所以有可能的话还是不要在这些框架外套个nginx了swoft+nginx:内存无波动,CPU占用81%swoft无nginx:内存无波动,CPU占用34% thinkphp+nginx41212345678910111213141516171819202122232425262728Concurrency Level: 200Time taken for tests: 24.256 secondsComplete requests: 10000Failed requests: 0Total transferred: 1940000 bytesHTML transferred: 190000 by...
2019-09-05
PHP 获取 对象唯一id spl_object_hash
1234567// 对象spl_object_hash测试$object = new stdClass;$id = spl_object_hash($object);var_dump($id); // 00000000408de7e4000000006ad86d42$object->id = 1;$id = spl_object_hash($object);var_dump($id); // 00000000408de7e4000000006ad86d42 注意When an object is destroyed, its hash may be reused for other objects.当对象被销毁时候,这个哈希id可能被其他对象重用
2015-09-10
mysql_fetch_assoc
mysql_fetch_assoc取出关联数组和mysql_fetch_array用assoc参数是一样的
2015-09-10
mysql_error
mysql_error() 函数返回上一个 MySQL 操作产生的文本错误信息。本函数返回上一个 MySQL 函数的错误文本,如果没有出错则返回 ‘’(空字符串)。
2018-07-01
php array_walk array_map
效率对比可以选用array_walk array_map foreach for 产生数组12$max = 100000;$arr = range(0, $max); for0.0202569961547850.0197999477386470.020244121551514[ 12345678// for$temp = 0;$t1 = microtime(true);for ($i = 0; $i < $max; $i++){ callback($arr[$i]);}$t2 = microtime(true); foreach0.0171449184417720.0175659656524660.02012300491333 1234567$temp=0;$t1 = microtime(true);foreach ($arr as $value) { callback($value);}$t2 = microtime(true);echo $t2 - $t1; array_walk0.02513313293457...
公告
This is my Blog