与Laravel的blocked.com集成

时间:2019-02-04 18:41:56

标签: php laravel laravel-5.2

我正在尝试在我的Laravel 5.2设置中集成blocked.com,但是我不想在公共文件夹中添加blocked.com脚本。我已将脚本保存在app / Libraries文件夹中。现在的问题是从该文件夹(从公共文件夹外部)打开一个PHP文件。

我正在尝试

Route::get('/block-det', [function () {
    return redirect()->to('../app/Libraries/blockscript/detector.php');
}]);

但这会将我重定向到https://example.com/app/Libraries/blockscript/index.php

1 个答案:

答案 0 :(得分:0)

public Vehicle function init(string stock=''){ if(len(trim(arguments.stock))){ this.stock = arguments.stock; } return this; } 将您重定向到新的URL,这就是为什么您将重定向到上面粘贴的URL的原因。您只想调用该php文件。您可以使用redirect

require

根据Route::get('/block-det', function() { require '../app/Libraries/blockscript/detector.php'; }); 的位置,您可能需要更改路径。

此外,如果您要引入第三者代码,则使用作曲家将其引入,这将是更为典型的做法,它会自动安装在供应商文件夹中,您可以通过这种方式从应用程序访问它。