php headlessNoverChromium \ browserfactory在file.php中找不到

发布于 2025-01-26 22:18:05 字数 428 浏览 2 评论 0 原文

<?php
use HeadlessChromium\BrowserFactory;

$browserFactory = new BrowserFactory();

?>

我已经安装了带有作曲家的Chrome-PHP/Chrome,并在课堂上悬停了鼠标会为我提供详细信息,但是当我尝试运行代码时,我会收到错误:

PHP Fatal error:  Uncaught Error: Class 'HeadlessChromium\BrowserFactory' not found in file.php

在初始设置中我缺少某些东西吗?不知道为什么它不起作用。我正在使用Visual Studio代码,并且该错误出现在“调试控制台”选项卡中,而不是问题选项卡。我在问题选项卡中没有任何问题。知道为什么是这种情况吗?

<?php
use HeadlessChromium\BrowserFactory;

$browserFactory = new BrowserFactory();

?>

I've installed chrome-php/chrome with composer and hovering my mouse over the class will give me the details but when I try to run the code I get the error:

PHP Fatal error:  Uncaught Error: Class 'HeadlessChromium\BrowserFactory' not found in file.php

Is there something I'm missing in the initial set up? Not sure why it isn't working. I'm using visual studio code and the bug appears in the debug console tab instead of the problems tab. I'm not getting any issues in the problems tab. Any idea why that is the case?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

痴梦一场 2025-02-02 22:18:05

使用作曲家时,您需要包括自动加载器

<?php
require __DIR__ . '/vendor/autoload.php';

use HeadlessChromium\BrowserFactory;

$browserFactory = new BrowserFactory();

When using composer you need to include the autoloader on top of the script.

<?php
require __DIR__ . '/vendor/autoload.php';

use HeadlessChromium\BrowserFactory;

$browserFactory = new BrowserFactory();
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文