PHP 尝试访问 Factual 时出错 API

PHP error when trying to access Factual API

我正在为我的 PHP 框架使用 WAMP。我正在尝试测试此代码

<?php
require_once "C:\wamp\www\factual-php-driver-master\Factual.php";
$factual= new Factual("/*API Key*/","/*API Secret*/");

$query= new FactualQuery;
$query->limit(3);
$res= $factual->fetch("places", $query);
print_r($res->getData());
?>

我的 Factual.php 文件的路径绝对正确,但文件 returns 出现以下错误

警告:require_once(C:\wamp\wwwactual-php-driver-master\Factual.php):无法打开流:C:\wamp\www\foodmeets\restaurants.[ 中的参数无效=41=] 第 2 行

致命错误:require_once():在 C 中需要 'C:\wamp\wwwactual-php-driver-master\Factual.php' (include_path='.;C:\php\pear') 打开失败:\wamp\www\foodmeets\restaurants.php 第 2 行

请注意,我已经使用命令

对 PHP 安装环境进行了测试
php -f test.php yourFactualKey yourFactualSecret [logfile]

如 PHP 的实际驱动程序 (V3) 中所述 Github(https://github.com/Factual/factual-php-driver)

你必须转义 \f(\f 元字符用于查找换页符。)

require_once "C:\wamp\www\factual-php-driver-master\Factual.php";

您的反斜杠已被 PHP 转换为特殊字符。 例如,...arrays\news.php 变成了

...数组

ews.php

你应该像这样逃避它们:

$路径="C:\NucServ\www\vv\static\arrays\news.php"; 或者使用单打,像这样:

$path = 'C:\NucServ\www\vv\static\arrays\news.php';

还有,你的if搞砸了。您不应该再次打开该文件。只需使用您已有的 $fp。

来源failed to open stream: Invalid argument