码迷,mamicode.com
首页 >  
搜索关键字:file_get_contents    ( 388个结果
获取API返回值
//$return=getApiResult($url);// if ($return==200){// //.....// }function getApiResult($url){ if(function_exists('file_get_contents')){...
分类:Windows程序   时间:2015-04-27 13:10:30    阅读次数:139
php图片转为资源数据
$file='C:\Users\feng\Desktop\images\banner.png'; //图片路径$type=getimagesize($file); //获取图片大小$photo=file_get_contents($file); ...
分类:Web程序   时间:2015-04-23 15:17:08    阅读次数:151
PHP:计算文件或数组中单词出现频率
一:如果是小文件,可以一次性读入到数组中,使用方便的数组计数函数进行词频统计(假设文件中内容都是空格隔开的单词): <?php $str = file_get_contents("/path/to/file.txt"); //get string from file pre...
分类:编程语言   时间:2015-04-21 09:23:40    阅读次数:108
php简单实现spider 抓URL
0x01spider抓取URL 采用的是file_get_contents()/fopen()函数,利用正则匹配的方式(貌似最简单方式了,记录下后续添加)0x02usage:php spider.php www.baidu.com 结果保存在www.baidu.com文件中Code:--------...
分类:Web程序   时间:2015-04-20 12:49:46    阅读次数:139
readfile & file_get_contents异同
记录一下:应用memcache时,准备把整个文件缓存到内存中,遇到了比较奇怪的事情,因为最初使用readfile来读取文件,结果这个函数返回一个字节数,而不是一个字符串,于是文件没办法再输出,最后使用file_get_contents解决问题。file_get_contents -- 将整个文件读入...
分类:其他好文   时间:2015-04-18 20:36:06    阅读次数:205
file_get_contents()的另一种使用方法
今天在网上看到一篇挺不错的文章,拿过来保存学习一下。本文源地址为:http://www.kuitao8.com/20140727/2867.shtml$data=file_get_contents("php://input"); php://input 是个可以访问请求的原始数据的只读流。 P...
分类:其他好文   时间:2015-04-17 15:12:56    阅读次数:391
取代file_get_contents 的一个采集函数
1 function url_get_content($url=''){ 2 $ch = curl_init(); 3 $timeout = 100; 4 $browser = 'Mozilla/5.0 (Windows NT 5.1; rv:20.0) Gecko/20100101 Firefo....
分类:其他好文   时间:2015-04-14 00:13:44    阅读次数:121
一些实用的公用php接口
百度获取ip地址归属地接口: ?function?ipView($value=‘‘) { $return?=?file_get_contents(‘http://api.map.baidu.com/location/ip?ip=‘.$value.‘&ak=qZzoWoRc3ceixVUFY6Qb9wOn‘); $baidu_mapA=json_decode...
分类:Web程序   时间:2015-04-10 11:45:15    阅读次数:283
Web 在线文件管理器学习笔记与总结(4)查看文件内容
② 查看文件内容a.通过 file_get_contents($filename) 得到文件内容b.通过 highlight_string($string) 或者 highlight_file($filename) 显示内容。使用 PHP 内置的语法高亮器所定义的颜色,打印输出或者返回输出或者返回语...
分类:Web程序   时间:2015-04-01 23:24:45    阅读次数:309
做了个弱统计,写入到文件中,引起并发问题,加锁解决
开始是使用file_get_contents,和file_put_contents()读取和写入文件,结果当同一时间大量请求时,文件内容就会出现重置为空的现象,导致原始内容丢失网上找了个解决办法,经修改如下:function pageCount($fileName){ if ($fp = fo...
分类:其他好文   时间:2015-03-31 19:36:18    阅读次数:153
388条   上一页 1 ... 27 28 29 30 31 ... 39 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!