简体   繁体   English

Class 放大器未找到

[英]Class Amp non found

I'm new on amphp and i'd like to try this very simple code first.我是 amphp 的新手,我想先试试这个非常简单的代码。 I downloaded amphp with composer for windows and save all folder created inside my project folder.我用作曲家为 windows 下载了 amphp 并保存在我的项目文件夹中创建的所有文件夹。

composer require amphp/http-client

Then my code is:然后我的代码是:

<?php

require __DIR__ . './autoload.php';

use Amp\Http\Client\HttpClientBuilder;
use Amp\Http\Client\HttpException;
use Amp\Http\Client\Request;
use Amp\Http\Client\Response;
use Amp\Loop;

$stringa = 'http://www.google.it/';

$request = new Request($stringa, "GET");
$location = $request->getHeader("Location");

var_dump($location);

But I get always 'Fatal error: Uncaught Error: Class 'Amp\Http\Client\Request' not found'但我总是得到'致命错误:未捕获的错误:Class'Amp\Http\Client\Request'未找到'

Any suggest?有什么建议吗?

I use wamp local server with php 7.0我使用带有 php 7.0 的 wamp 本地服务器

Also,after, I need to yield all the code...另外,之后,我需要yield所有代码......

Here are a few things that look for:以下是一些需要寻找的东西:

  • Did the autoload.php get included correctly? autoload.php是否正确包含在内?
    • I see there is an unnecessary .我看到有一个不必要的. before /autoload.php ./autoload.php之前。
  • Did you use the correct class name with the correct namespace?您是否使用了正确的 class 名称和正确的命名空间?
  • Did you run composer require amphp/http-client so that the libraries will be installed?您是否运行了composer require amphp/http-client以便安装这些库?
  • Do the library's files exist inside the vendor/amphp/http-client directory?库的文件是否存在于vendor/amphp/http-client目录中?
  • If you're on Windows, use \ in the require statement.如果您使用的是 Windows,请在require语句中使用\

Apart from these, I can't think of why the library won't load.除此之外,我想不出为什么图书馆不会加载。 I hope this helps.我希望这有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM