Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/274.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 使用重定向类时出现Laravel白屏_Php_Redirect_Laravel 4 - Fatal编程技术网

Php 使用重定向类时出现Laravel白屏

Php 使用重定向类时出现Laravel白屏,php,redirect,laravel-4,Php,Redirect,Laravel 4,当我试图在处理数据后使用Laravel redirect类重定向我的用户时,我现在得到了一个白色的死亡屏幕。如果我使用本机php函数头(“location…”),应用程序将正确响应并以愉快的方式发送给用户,但使用Laravel的重定向类,站点将崩溃,出现一个白色的死亡屏幕。我尝试了Redirect::action和Redirect::to函数,但它们都导致了同样令人恼火的白屏死亡。laravel.log没有显示任何内容 有人有什么想法吗 以下是数据处理程序控制器类的代码: <?php cl

当我试图在处理数据后使用Laravel redirect类重定向我的用户时,我现在得到了一个白色的死亡屏幕。如果我使用本机php函数头(“location…”),应用程序将正确响应并以愉快的方式发送给用户,但使用Laravel的重定向类,站点将崩溃,出现一个白色的死亡屏幕。我尝试了Redirect::action和Redirect::to函数,但它们都导致了同样令人恼火的白屏死亡。laravel.log没有显示任何内容

有人有什么想法吗

以下是数据处理程序控制器类的代码:

<?php
class ManagerLayoutDataController extends BaseController 
{
public function route($action, $moduleID) {
    if(method_exists('ManagerLayoutDataController',$action)) {
        $this->$action($moduleID);
    }
    // Invalid action (method not found)
    else {
        die('Action routing error');
        //return Redirect::to('/');
    }
}

public function updateHeaderBg($moduleID) {
    $image = Input::file('img');
    $user = Auth::user();
    $siteID = $user->getSiteID();

    $layoutDataMessage = null;

    // Validate file upload (NOT FILE CHARACTERISTICS)
    if(Input::hasFile('img') && $image->isValid() && isset($siteID) && $siteID !== "") {
        $res = ManagerFileUpload::uploadImage($siteID, $image);
        if($res->success) {
            $fileName = $res->fileName;
            $dbViewModule = ViewModuleRepository::getModule($moduleID);
            if($dbViewModule->type === DBViewModule::MODULE_TYPE_HEADER) {
                $headerModule = new HeaderModule($dbViewModule);
                $headerModule->updateBgImage($fileName);
                $layoutDataMessage = new LayoutDataMessage(LayoutDataMessage::STATUS_SUCCESS,"");
            }
        }
        else {
            $layoutDataMessage = new LayoutDataMessage(LayoutDataMessage::STATUS_FAIL,$res->message);
        }

    }
    else {
        $layoutDataMessage = new LayoutDataMessage(LayoutDataMessage::STATUS_FAIL, "Bilden kunde inte laddas upp.");
    }

    if($layoutDataMessage != null) {
        return Redirect::action('ManagerLayoutController@main')->with('message',$layoutDataMessage);
        //return Redirect::to('manager/layout/');
        //header('location: */manager/layout');
    }
    else {
        return Redirect::action('ManagerLayoutController@main')->with('message',LayoutDataMessage(LayoutDataMessage::STATUS_FAIL, "Bilden kunde inte laddas upp."));
        //return Redirect::to('manager/layout/');
        //header('location: */manager/layout');
    }
}
}
尝试添加

ini_set('display_errors', 1);
它至少应该告诉您实际的错误是什么。 这仅适用于开发模式,在投入生产时将其删除

查看重定向之前是否有“返回”。例如:

// Unauthorized access
else {
    die('Filter error');
    //Redirect::to('/');
}

这里应该是return Redirect::to('/')

所以直接访问路由不会给您带来错误,但重定向到路由会带来错误?确实如此。在处理用户的输入后,我将用户发送回主显示器(在那里他们可以编辑数据)。如果您认为有帮助,我可以向您展示发送用户的控制器的代码?如果我使用php header函数而不是Redirect,它可以正常工作。当重定向发生时,接收控制器是否需要任何未被传输的参数?(我知道这可能是一件非常明显的事情,但我只是想排除可能性)。包含控制器代码不会有任何伤害。我没有任何冒犯的地方,请说明你能想到的任何事情。我将包括主控制器。我还添加了相关的filter.php和routes.php。为了覆盖laravel错误处理程序,我必须把这一行放在哪里?我试着把它放在index.php文件的顶部,但我还是得到了一个白色的屏幕。我把它放在routes.php的顶部,它似乎对我有用,以供将来参考。
<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/

Route::get('/', 'FrontController@main');

Route::get('/manager', 'ManagerHomeController@home');
Route::get('/manager/statistics', 'ManagerStatisticsController@main');
Route::get('/manager/resume-manager', 'ManagerResumeController@main');
Route::get('/manager/resume-manager/pending', 'ManagerResumeController@resumesPending');
Route::get('/manager/resume-manager/approved', 'ManagerResumeController@resumesApproved');
Route::get('/manager/resume-manager/rejected', 'ManagerResumeController@resumesRejected');
Route::get('/manager/layout', 'ManagerLayoutController@main');
Route::get('/manager/layout-old', 'OLDManagerLayoutController@main');

Route::post('/manager/layout/data/{action}/{moduleID}/', array('before'=>'viewmodule.ownership', 'uses' => 'ManagerLayoutDataController@route'));

Route::get('/manager/setup', 'ManagerSetupController@setup');

Route::get('/admin', 'AdminHomeController@home');
Route::get('/login', 'UsersController@login');

Route::get('/test', 'TestController@testMail');

// Confide routes
Route::get('users/create', 'UsersController@create');
Route::post('users', 'UsersController@store');
Route::get('users/login', 'UsersController@login');
Route::post('users/login', 'UsersController@doLogin');
Route::get('users/confirm/{code}', 'UsersController@confirm');
Route::get('users/forgot_password', 'UsersController@forgotPassword');
Route::post('users/forgot_password', 'UsersController@doForgotPassword');
Route::get('users/reset_password/{token}', 'UsersController@resetPassword');
Route::post('users/reset_password', 'UsersController@doResetPassword');
Route::get('users/logout', 'UsersController@logout');
ini_set('display_errors', 1);
// Unauthorized access
else {
    die('Filter error');
    //Redirect::to('/');
}