PHP 函数的 JavaScript 实现
module.exports = function array_sum (array) { // eslint-disable-line camelcase // discuss at: http://locutus.io/php/array_sum/ // original by: Kevin van Zonneveld (http://kvz.io) // bugfixed by: Nate // bugfixed by: Gilbert // improved by: David Pilia (http://www.beteck.it/) // improved by: Brett Zamir (http://brett-zamir.me) // example 1: array_sum([4, 9, 182.6]) // returns 1: 195.6 // example 2: var $total = // example 2: var $index = 0.1 // example 2: for (var $y = 0; $y Underscore.js 的 PHP 版
function __($item=null) { $__ = new __; if(func_num_args > 0) $__->_wrapped = $item; return $__;}自动天生 gitignore 文件
https://www.gitignore.io/api/laravel# Created by https://www.gitignore.io/api/laravel### Laravel ###vendor/node_modules/npm-debug.log# Laravel 4 specificbootstrap/compiled.phpapp/storage/# Laravel 5 & Lumen specificpublic/storagepublic/hotstorage/.key.env..php.env.php.envHomestead.yamlHomestead.json# Rocketeer PHP task runner and deployment package. https://github.com/rocketeers/rocketeer.rocketeer/# End of https://www.gitignore.io/api/laravel爬虫组件
composer global require slince/spider @devuse Slince\Spider\Spider;$spider = new Spider;$spider->run('http://www.baidu.com');大略、 灵巧、强大的 PHP 采集工具
use QL\QueryList;//采集某页面所有的图片$data = QueryList::Query('http://cms.querylist.cc/bizhi/453.html',array( //采集规则库 //'规则名' => array('jQuery选择器','要采集的属性'), 'image' => array('img','src') ))->data;//打印结果print_r($data);//采集某页面所有的超链接//可以先手动获取要采集的页面源码$html = file_get_contents('http://cms.querylist.cc/google/list_1.html');//然后可以把页面源码或者HTML片段传给QueryList$data = QueryList::Query($html,array( 'link' => array('a','href') ))->data;//打印结果print_r($data);在线测试采集并查看采集结果 http://querylist.cc/page-Querytest.html在线测试代码
$array=[ ['name'=>'张三','age'=>'23'], ['name'=>'李四','age'=>'64'], ['name'=>'王五','age'=>'55'], ['name'=>'赵六','age'=>'66'], ['name'=>'孙七','age'=>'17'],];$sort = array( 'direction' => 'SORT_ASC', //排序顺序标志 SORT_DESC 降序;SORT_ASC 升序 'field' => 'age', //排序字段);$arrSort = array;foreach($array as $uniqid => $row){ foreach($row AS $key=>$value){ $arrSort[$key][$uniqid] = $value; }}array_multisort($arrSort[$sort['field']], constant($sort['direction']), $array);print_r($array);中文转拼音工具
//https://hellogithub.com/category/PHP%20%E9%A1%B9%E7%9B%AE/use Overtrue\Pinyin\Pinyin;$pinyin = new Pinyin;$pinyin->convert('带着希望去旅行,比到达终点更美好');// [\公众dai\"大众, \"大众zhe\公众, \公众xi\"大众, \"大众wang\公众, \"大众qu\"大众, \公众lv\"大众, \"大众xing\"大众, \公众bi\"大众, \公众dao\"大众, \"大众da\"大众, \"大众zhong\"大众, \公众dian\"大众, \"大众geng\公众, \"大众mei\"大众, \"大众hao\"大众]$pinyin->convert('带着希望去旅行,比到达终点更美好', PINYIN_UNICODE);// [\"大众dài\"大众,\公众zhe\"大众,\"大众xī\"大众,\"大众wàng\"大众,\公众qù\"大众,\"大众lǚ\公众,\"大众xíng\公众,\公众bǐ\"大众,\"大众dào\"大众,\"大众dá\公众,\公众zhōng\公众,\"大众diǎn\"大众,\"大众gèng\"大众,\"大众měi\"大众,\"大众hǎo\"大众]$pinyin->convert('带着希望去旅行,比到达终点更美好', PINYIN_ASCII);//[\公众dai4\"大众,\公众zhe\公众,\"大众xi1\"大众,\"大众wang4\公众,\公众qu4\"大众,\公众lv3\公众,\"大众xing2\公众,\"大众bi3\"大众,\"大众dao4\公众,\"大众da2\"大众,\"大众zhong1\公众,\"大众dian3\"大众,\"大众geng4\公众,\公众mei3\"大众,\"大众hao3\"大众]
由于篇幅的缘故原由,本次的分享就到这里啦,下次讲给大家带来更多php开拓实用工具~
轻量级且便捷的PHP IDE PhpStorm加入在线订购快捷通道!
续费更有优惠,戳这里看详情>>>
有用(0)没用(0)