简体   繁体   中英

Can't get the Dropbox API PHP Tutorial to work

I am playing with the Dropbox api but can't get past the first step of making it work. Any help would be great! I did try to do a thorough search on Google for my problem with no luck.

Tutorial Link -> https://www.dropbox.com/developers/core/start/php

PHP Version: 5.3.8

I am getting an error on this line:

use \Dropbox as dbx;

It is throwing this error: Parse error: syntax error,

 unexpected T_USE in . . . 

My code is extremely simple so far:

require_once "dropbox-sdk/Dropbox/autoload.php";
use \Dropbox as dbx;

Thanks for your help.

The code you have posted is syntactically correct, but the use declaration has certain restraints that you need to follow.

Ensure you're use statements are being processed before any other code is run bar the required require_once .

<?php
require_once 'dropbox-sdk/Dropbox/autoload.php';
use \Dropbox as dbx;
?>

This will (and does) parse correctly as the entire contents of the script.

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