今天小编给大家整理了一些php开发中可能需要用到的工具或组建,需要的朋友可以参考和收藏哦~
今天小编给大家整理了一些php开发中可能需要用到的工具或组建,需要的朋友可以参考和收藏哦~
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 < 12; $y++){ $total[$y] = $y + $index } // example 2: array_sum($total) // returns 2: 67.2 var key var sum = 0 // input sanitation if (typeof array !== 'object') { return null } for (key in array) { if (!isNaN(parseFloat(array[key]))) { sum += parseFloat(array[key]) } } return sum}
点击查看>
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 SlinceSpiderSpider;$spider = new Spider();$spider->run('http://www.baidu.com');
点击查看>
简单、 灵活、强大的 PHP 采集工具
use QLQueryList;//采集某页面所有的图片$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 OvertruePinyinPinyin;$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加入在线订购快捷通道!续费更有优惠,戳这里看详情>>>
<更多产品、活动信息请咨询客服>
标签:PHPPHPIDE
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!