简体   繁体   中英

Trouble with loading phar file

I'm interested in trying cloudconvert with php, but I can't get it to work. 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. 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

Fatal error: require(): Failed opening required 'phar://cloudconvert-php.phar/vendor/autoload.php' (include_path='.:') in /Library/WebServer/Documents/index.php on line 2

I'm not into cloudconvert but this is what I read ...

You actually not loading a phar ... You try to load the autoload.php ...

Assuming cloudconvert-php.phar/vendor/autoload.php is your full path

your should do:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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