PHP没有使用完整的URL?
这是我的代码:PHP没有使用完整的URL?,php,Php,这是我的代码: <?php $url = "https://api.datamarket.azure.com/opendata.rdw/VRTG.Open.Data/v1/KENT_VRTG_O_DAT?$filter=Kenteken%20eq%20%2701GBB1%27"; $xml = simplexml_load_file($url); ?> 我正在尝试将这个.XML文件放入我的$url中。问题是它的使用 而不是带过滤器的: ?$filter=Kenteken%20
<?php
$url = "https://api.datamarket.azure.com/opendata.rdw/VRTG.Open.Data/v1/KENT_VRTG_O_DAT?$filter=Kenteken%20eq%20%2701GBB1%27";
$xml = simplexml_load_file($url);
?>
我正在尝试将这个.XML文件放入我的$url中。问题是它的使用
而不是带过滤器的:
?$filter=Kenteken%20eq%20%2701GBB1%27
为什么它不接受我在那里输入的URL?当我在浏览器中打开URL时,我会得到一个经过过滤的URL,但当我运行代码时,它会给我另一个.XML
我希望有人能帮助我。您使用的是双引号,因此php将
$filter
解释为一个(可能未定义的…)变量
您可以避免使用单引号:
$url = 'https://api.datamarket.azure.com/opendata.rdw/VRTG.Open.Data/v1/KENT_VRTG_O_DAT?$filter=Kenteken%20eq%20%2701GBB1%27';
您使用的是双引号,因此php将把
$filter
解释为一个(可能未定义的…)变量
您可以避免使用单引号:
$url = 'https://api.datamarket.azure.com/opendata.rdw/VRTG.Open.Data/v1/KENT_VRTG_O_DAT?$filter=Kenteken%20eq%20%2701GBB1%27';
使用单引号
然后使用单引号
那你试过这个了吗
<?php
$url='https://api.datamarket.azure.com/opendata.rdw/VRTG.Open.Data/v1/KENT_VRTG_O_DAT? $filter=Kenteken%20eq%20%2701GBB1%27';
$xml = new SimpleXMLElement(file_get_contents($url));
?>
您试过这个吗
<?php
$url='https://api.datamarket.azure.com/opendata.rdw/VRTG.Open.Data/v1/KENT_VRTG_O_DAT? $filter=Kenteken%20eq%20%2701GBB1%27';
$xml = new SimpleXMLElement(file_get_contents($url));
?>
Pff太简单,sry在这里浪费你的时间。Pff太简单,sry在这里浪费你的时间。