Home > Backend Development > PHP Tutorial > 为什么我用不了php的第三方libraries?

为什么我用不了php的第三方libraries?

WBOY
Release: 2016-06-06 20:20:57
Original
1583 people have browsed it

我用的管理工具是composer,代码完全复制人家的example。但是就是有下面这个error:

Fatal error: require(): Failed opening required '/vendor/autoload.php' (include_path='.:/Applications/XAMPP/xamppfiles/lib/php') in /Applications/XAMPP/xamppfiles/htdocs/test.php on line 3

<code>require  'vendor/autoload.php';
use Icicle\Loop;

Loop\timer(1, function () { // Executed after 1 second.
echo "First.\n";
Loop\timer(1.5, function () { // Executed after 1.5 seconds.
    echo "Second.\n";
});
echo "Third.\n";
Loop\timer(0.5, function () { // Executed after 0.5 seconds.
    echo "Fourth.\n";
});
echo "Fifth.\n";
});

echo "Starting event loop.\n";
Loop\run();</code>
Copy after login
Copy after login

回复内容:

我用的管理工具是composer,代码完全复制人家的example。但是就是有下面这个error:

Fatal error: require(): Failed opening required '/vendor/autoload.php' (include_path='.:/Applications/XAMPP/xamppfiles/lib/php') in /Applications/XAMPP/xamppfiles/htdocs/test.php on line 3

<code>require  'vendor/autoload.php';
use Icicle\Loop;

Loop\timer(1, function () { // Executed after 1 second.
echo "First.\n";
Loop\timer(1.5, function () { // Executed after 1.5 seconds.
    echo "Second.\n";
});
echo "Third.\n";
Loop\timer(0.5, function () { // Executed after 0.5 seconds.
    echo "Fourth.\n";
});
echo "Fifth.\n";
});

echo "Starting event loop.\n";
Loop\run();</code>
Copy after login
Copy after login

看看路径是不是写错了。。。

很可能就是引用的路径有问题了,可以看到在对应的目录下是否有对应的文件,既然绝对路径都打印出来了

在你的framework 里面先加载 vendor下的autoload.php

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template