Home >php教程 >PHP源码 >stream_context_create()函数的应用

stream_context_create()函数的应用

PHP中文网
PHP中文网Original
2016-05-25 17:04:151175browse

stream_context_create()函数是用来 创建打开文件的上下文件选项 ,用于fopen(),file_get_contents()等过程的超时设置、代理服务器、请求方式、头信息设置的特殊过程。 
看手册上是这样说的,你们平时用的多么?

//设置代理服务器
$opts = array('http'=>array('request_fulluri'=>true));
$context = stream_context_create($opts);
$content = file_get_contents($url,false,$context);
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn