要求我的laravel项目中的一次/包含功能不正常。我正在使用正确的路径,但我继续得到相同的错误。我可以看到文件在指定的空间。什么可能导致这个?这是我的代码:
@extends('apps.admin')
@section('main')
<?php
include(app_path().'vendor/j7mbo/twitter-api-php/TwitterAPIExchange.php');
$settings = array(
'oauth_access_token' => "token",
'oauth_access_token_secret' => "token",
'consumer_key' => "token",
'consumer_secret' => "token"
);
$url = 'https://api.twitter.com/1.1/search/tweets.json';
$getfield = '?q=#nerd';
$requestMethod = 'GET';
$twitter = new TwitterAPIExchange($settings);
$response = $twitter->setGetfield($getfield)
->buildOauth($url, $requestMethod)
->performRequest();
var_dump(json_decode($response));
?>
@stop
我也试过这个:
require_once('vendor/j7mbo/TwitterAPIExchange.php');
和此:
require_once('TwitterAPIExchange.php');
错误:
include(/var/www/web/elephantegin/htdocs/app/vendor/j7mbo/twitter-api-php/TwitterAPIExchange.php): failed to open stream: No such file or directory (View: /var/www/web/elephantegin/htdocs/resources/views/socialApps/twitter.blade.php)
errror:
main(): Failed opening required '/vendor/j7mbo/TwitterAPIExchange.php' (include_path='.:/usr/share/php:/var/www/web/elephantegin/htdocs')
答案 0 :(得分:1)
您正在错误地引用该文件,请使用正确的路径:
include(app_path().'../vendor/j7mbo/twitter-api-php/TwitterAPIExchange.php');