小编use*_*179的帖子

无法打开流:权限被拒绝生成XML文件的file_get_contents

我正在尝试生成一个XML文件,但错误来自这个file_get_contents()PHP函数,这是我的代码:

 function mobile_login1($P1, $P2)
{
    $url = 'myURL';
    $data = array(
        'username' => $P1,
        'password' => $P2);

    // use key 'http' even if you send the request to https://...
    $options = array(
        'http' => array(
            'header'  => "Content-type: application/x-www-form-urlencoded",
            'method'  => 'POST',
            'content' => http_build_query($data),
        ),
    );
    $context  = stream_context_create($options);
    $json_data = file_get_contents($url, false, $context);


            $decode = json_decode($json_data);

            //print_r ($decode[0]);
            //

            foreach($decode as $row)
            {
                $data[] = array("Message" => $row->msg);


            }


            //print_r ($data[0]['Message']);

            $msg = $data[0]['Message'];

            if ($msg …
Run Code Online (Sandbox Code Playgroud)

php xml

2
推荐指数
2
解决办法
9618
查看次数

标签 统计

php ×1

xml ×1