简体   繁体   English

加载Phar文件时遇到问题

[英]Trouble with loading phar file

I'm interested in trying cloudconvert with php, but I can't get it to work. 我对尝试使用PHP进行cloudconvert感兴趣,但是我无法使其正常工作。 I put the phar file in the same folder as index.php but when I'm running this code I get the error message below. 我将phar文件与index.php放在同一文件夹中,但是当我运行此代码时,出现以下错误消息。 What's wrong? 怎么了?

<?php
require 'phar://cloudconvert-php.phar/vendor/autoload.php';
use \CloudConvert\Api;
$api = new Api(“my_api_key”);

Warning: require(phar://cloudconvert-php.phar/vendor/autoload.php): failed to open stream: phar error: invalid url or non-existent phar "phar://cloudconvert-php.phar/vendor/autoload.php" in /Library/WebServer/Documents/index.php on line 2 警告:require(phar://cloudconvert-php.phar/vendor/autoload.php):无法打开流:phar错误:无效的URL或不存在的phar“ phar://cloudconvert-php.phar/vendor/autoload .php”位于第2行的/Library/WebServer/Documents/index.php中

Fatal error: require(): Failed opening required 'phar://cloudconvert-php.phar/vendor/autoload.php' (include_path='.:') in /Library/WebServer/Documents/index.php on line 2 致命错误:require():无法在第2行的/Library/WebServer/Documents/index.php中打开所需的'phar://cloudconvert-php.phar/vendor/autoload.php'(include_path ='.:')。

I'm not into cloudconvert but this is what I read ... 我不喜欢cloudconvert,但这是我读到的...

You actually not loading a phar ... You try to load the autoload.php ... 您实际上没有加载phar ...您尝试加载autoload.php ...

Assuming cloudconvert-php.phar/vendor/autoload.php is your full path 假设cloudconvert-php.phar/vendor/autoload.php是您的完整路径

your should do: 您应该做:

require('cloudconvert-php.phar/vendor/autoload.php')

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

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