首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

libxml_set_streams_context

(PHP 5, PHP 7)

libxml_set_streams_context - 为下一个libxml文档加载或写入设置流上下文

描述

代码语言:javascript
复制
void libxml_set_streams_context ( resource $streams_context )

为下一个libxml文档加载或写入设置流上下文。

参数

streams_context

流上下文资源(使用stream_context_create()创建)

返回值

没有值返回。

例子

示例#1 libxml_set_streams_context()示例

代码语言:javascript
复制
<?php

$opts = array(
    'http' => array(
        'user_agent' => 'PHP libxml agent',
    )
);

$context = stream_context_create($opts);
libxml_set_streams_context($context);

// request a file through HTTP
$doc = DOMDocument::load('http://www.example.com/file.xml');

?>

扩展内容

  • stream_context_create() - 创建一个流上下文

← libxml_set_external_entity_loader

libxml_use_internal_errors →

扫码关注腾讯云开发者

领取腾讯云代金券