为什么我不能在名称空间中使用CURL?

发烧友

刚刚将我的项目移到了几乎相同的环境:Windows 10,Apache 2.4,PHP 7.0.3,但是突然Curl不想初始化,就像没有安装(但是加载了扩展程序)一样。

我发现它需要反斜杠,例如\ curl_init()或\ CURLOPT_RERURNTRANSFER-但我想知道为什么在没有其他相同环境的PC上可以正常工作吗?以及如何在新PC上没有该死的反斜杠的情况下使其正常工作?

public function getCurl(int $instantiate, array $params = [], string $url = ''): CUrl
{
    $args = func_get_args();
    array_shift($args);
    return self::handleCaching($instantiate, 'asoft\\CUrl', ...$args);
}

protected function handleCaching(int $instantiate, string $class, ...$args)
{

    switch ($instantiate) {
        case self::NEW_INSTANCE:
            return new $class(...$args);
        case self::CACHED_INSTANCE:
            if (!array_key_exists($class, self::$cache)) {
                self::$cache[$class] = new $class(...$args);
            }
            return self::$cache[$class];
    }

    throw new EngineError('Wrong value for instantiating type: $instance.');
}

注意:使用未定义的常量CURLOPT_RETURNTRANSFER-在C:\ Apache24 \ htdocs \ audiophilesoft.local \ vendor \ asoft \ PersistenceFactory.php:185中假定为'CURLOPT_RETURNTRANSFER' htdocs \ audiophilesoft.local \ vendor \ asoft \ PersistenceFactory.php:185

错误:调用C:\ Apache24 \ htdocs \ audiophilesoft.local \ vendor \ asoft \ CUrl.php:27中未定义的函数asoft \ curl_init():堆栈跟踪:

第185行是“受保护的函数handleCaching(...)”,如您所见,那里绝对没有常量。

我只有在新PC上才有此问题。

发烧友

看来,问题出在Windows包含路径中没有PHP和/或Apache文件夹。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

通用lambda不能在名称空间中使用吗?

为什么不能在用户名称空间中绑定挂载“ /”?

为什么我不能使用双冒号在名称空间中向前声明一个类?

为什么我不能在VBA中使用“任何”作为名称?

为什么我不能在我的代码中使用“ balance ”?

为什么我不能将此运算符重载放在与结构相同的名称空间中?

当架构具有elementFormDefault =“ unqualified”时,为什么不能在xml实例中使用默认名称空间?

为什么我不能在开关案例中使用枚举?

为什么我不能在Swift中使用'object == nil'?

为什么我不能在CSS Variable中使用rgba?

为什么我不能在界面中使用默认方法?

为什么我不能在匿名类中使用<Class> .this?

为什么我不能在TRecord中使用Variable?

为什么我不能在列表中使用匿名函数?

为什么我不能在 Spark 中使用 combineByKey?

为什么我不能在Spark的mapPartitions中使用foreach

为什么我不能在Laravel中使用关系方法?

为什么我不能在Swift中使用let in协议?

为什么我不能在Flutter中使用某些图标?

为什么不能在我的Magic Square程序中使用

为什么我不能在Activity中使用FloatingActionButton

为什么我不能在Crontab中使用Python 3?

为什么我不能在grep中使用^ \ s?

为什么我不能在 observable 中使用 switchMap

为什么我不能在 useEffect 中使用 dispatch a thunk?

为什么我不能在blazor中使用JSInterop?

为什么我不能在Python中使用“ +”合并字典?

为什么我不能在App Component中使用MyContext?

为什么我不能在JCreator中使用JavaFX?