
php
cai555
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
在PHP中使用Curl
摘要:在这篇文章中主要讲解php_curl库的知识,并教你如何更好的使用php_curl。简介你可能在你的编写PHP脚本代码中会遇到这样的问题:怎么样才能从其他站点获取内容呢?这里有几个解决方式;最简单的就是在php中使用fopen()函数,但是fopen函数没有足够的参数来使用,比如当你想构建一个“网络爬虫”,想定义爬虫的客户端描述(IE,fire...原创 2009-03-05 15:34:16 · 116 阅读 · 0 评论 -
使用Eclipse PDT开发php
首先到http://www.zend.com/ptd下载PDT all in one 包,解压后,下载apache安装之,修改httpd.conf将documentRoot指向到你的workspace/myproject,然后到www.php.net下载php的win32安装包,按照提示安装好后,启动eclipse就可以调试,使用php了。...2008-11-19 11:58:43 · 177 阅读 · 0 评论 -
php多线程
一直没有找到PHP有像JAVA一样的多线程机制,网上有的也只是使用get&post模拟出来的多线程。今天,偶尔看到PHP 4 >= 4.1.0, PHP 5有这个函数: pcntl_fork — Forks the currently running process Description int pcntl_fork ( void ...2009-04-02 09:50:39 · 346 阅读 · 0 评论 -
PHP获取文件创建时间和修改时间相关函数
filemtime ( string filename )返回文件上次被修改的时间,出错时返回 FALSE。时间以 Unix 时间戳的方式返回,可用于 date()。 filectime ( string filename )返回文件上次 inode 被修改的时间,如果出错则返回 FALSE。时间以 Unix 时间戳的方式返回。 fileatime ( string filenam...原创 2009-03-31 14:01:31 · 146 阅读 · 0 评论 -
PHP中合并数组的一个简单方法
引用:http://www.21andy.com/blog/20071104/658.html 通常,我们合并多个数组用的是array_merge()函数,其实,PHP手册中关于数组操作符的介绍给了我们更简单的方法,那就是"+"号,看看下面的例子就明白了(详细了解)代码:<?php$a = array('a' => 'a', 'b' =&g...原创 2009-03-29 18:03:57 · 119 阅读 · 0 评论 -
解决PHP file_exists 函数不支持中文文件
今天想使用这一句php来判断一个文件是否存在: echo is_file('/var/downloads/donkey/incoming/[当地球停止转动].The.Day.The.Earth.Stood.Still.DVDRip.XviD-DMT.avi')?"true":"false"; 结果总是报false 估计原因是php的编码格式和操作系统的文件名编码格式不统一,所以就超市使用...2009-03-25 15:59:13 · 112 阅读 · 0 评论 -
php读取二进制流(C语言结构体struct数据文件)
尽管php是用C语言开发的,不过令我不解的是php没有提供对结构体struct的直接支持。不过php提供了pack和unpack函数,用来进行二进制数据(binary data)和php内部数据的互转: string pack ( string $format [, mixed $args [, mixed $...]] ) //Pack given arguments into bina...原创 2009-03-24 19:14:01 · 274 阅读 · 0 评论 -
使用php simple html dom parser解析html标签
用了一下PHP Simple HTML DOM Parser解析HTML页面,感觉还不错,它能创建一个DOM tree方便你解析html里面的内容。用来抓东西挺好的。 附带一个例子,你也到sourceforge下载压缩包看里面的例子: Scraping data with PHP Simple HTML DOM Parser Stumble Upon it...原创 2009-03-20 17:12:33 · 225 阅读 · 0 评论 -
php过滤HTML代码
strip_tags --- 去除字串中的HTML和PHP标签语法 : string strip_tags (string str [, string allowable_tags])说明 : 此函式试着从给予的字串中去除所有HTML和PHP标签,如果是不完整或是假的标签时则会有错误,它和fgetss( )使用相同的方法去除标签。你可以使用第三个参数来指定不去除那些标签...原创 2009-03-20 17:06:07 · 1371 阅读 · 0 评论 -
CURL写的post、get类
<?phpclass cURL {var $headers;var $user_agent;var $compression;var $cookie_file;var $proxy;function cURL($cookies=TRUE,$cookie='cookies.txt',$compression='gzip',$proxy='') {$this->header...原创 2009-03-20 17:04:23 · 143 阅读 · 0 评论 -
让 php curl_exec直接返回字符串
如果想php 的curl函数直接返回字符串,而不是存储到某个文件,应该怎么做呢? $c = curl_init();curl_setopt($c, CURLOPT_URL, $url);//Tell curl to write the response to a variablecurl_setopt($c, CURLOPT_RETURNTRANSFER, 1);// The maxi...2009-03-19 20:49:11 · 1528 阅读 · 0 评论 -
How to download a remote image using GD or cURL
This a PHP Class useful if you need todownload images from a remote location. You can choose between 2methods to retrieve the image: using GD or cURL.Here is the class (I will explain you how ...原创 2009-03-05 15:41:51 · 157 阅读 · 0 评论 -
【转载】PHP CURL 参数详解
2008-03-26 18:27curl用法:cookie及post一、cookie用法<?php $cookie_jar = tempnam('./tmp','cookie'); // login $c=curl_init('http://login_url?username=... curl_setopt($c, CURLOPT_RETURNTRANSFER, ...原创 2009-03-05 15:35:03 · 211 阅读 · 0 评论 -
php文件保存
今天安装了php5发现,访问php页面时浏览器把php当做文件保存。原因是httpd.conf少了一个配置:AddType text/html php2009-11-07 22:29:06 · 150 阅读 · 0 评论