Php Laravel视图在生产中工作,但不在本地工作

Php Laravel视图在生产中工作,但不在本地工作,php,laravel,apache,xampp,windows-10,Php,Laravel,Apache,Xampp,Windows 10,当我使用XAMPP转到本地计算机上的特定url时 在生产服务器中 本地请求没有可用的响应数据 还有其他页面使用与此页面相同的页眉和页脚,它们在本地和生产服务器中都可以正常加载 下面是编辑的样子 /** * Show the form for editing the specified resource. * * @param \App\OrganizationUser $org_user * @return \Illuminate\Http\Response */ publ

当我使用XAMPP转到本地计算机上的特定url时

在生产服务器中

本地请求没有可用的响应数据


还有其他页面使用与此页面相同的页眉和页脚,它们在本地和生产服务器中都可以正常加载

下面是编辑的样子

/**
 * Show the form for editing the specified resource.
 *
 * @param  \App\OrganizationUser  $org_user
 * @return \Illuminate\Http\Response
 */
public function edit(Request $request, OrganizationUser $org_user, Organization $model1, User $model2)
{
    // Check if user is admin
    $auth_user = Auth::user();

    $path = $request->path();

    $organization_id = (int)explode('/', $path)[1];

    $user_id = (int)explode('/', $path)[3];

    //dd($org_user->load('user')->load('organization'));

    if($auth_user->isAdmin()) {

        return view('organizations.users.edit', [
                                                'org_user' => $org_user->load('user')->load('organization')->where('id', $user_id)->first(),
                                                'organizations' => $model1::where('id', $organization_id)->get(['id', 'name']),
                                                'users' => $model2->get(['id', 'name'])
                                                ]);        
    
    } else {


        abort(404);

    }
    
}

到目前为止我试过什么

  • 清除配置缓存
  • 清除路由缓存
  • 清除视图缓存
  • 清除事件缓存
  • 清除应用程序缓存
  • 清除所有缓存
  • 正在从Composer的缓存中清除内容
  • 清除NPM缓存
  • 使用不同的浏览器(在Chrome和Firefox中测试)

  • 通过XAMPP控制台重新启动Apache

  • 重新启动计算机


  • 编辑 根据请求,/public文件夹中有.htaccess

    <IfModule mod_rewrite.c>
        <IfModule mod_negotiation.c>
            Options -MultiViews -Indexes
        </IfModule>
    
        RewriteEngine On
    
        # Handle Authorization Header
        RewriteCond %{HTTP:Authorization} .
        RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    
        # Redirect Trailing Slashes If Not A Folder...
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_URI} (.+)/$
        RewriteRule ^ %1 [L,R=301]
    
        # Handle Front Controller...
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^ index.php [L]
    </IfModule>
    
    
    选项-多视图-索引
    重新启动发动机
    #句柄授权头
    RewriteCond%{HTTP:Authorization}。
    重写规则。*-[E=HTTP\U授权:%{HTTP:AUTHORIZATION}]
    #如果不是文件夹,则重定向尾部斜杠。。。
    重写cond%{REQUEST_FILENAME}-D
    重写cond%{REQUEST_URI}(+)/$
    重写规则^1[L,R=301]
    #处理前控制器。。。
    重写cond%{REQUEST_FILENAME}-D
    重写cond%{REQUEST_FILENAME}-F
    重写规则^index.php[L]
    
    尝试此操作,更改您的httacces文件:

    <IfModule mod_rewrite.c>
        RewriteEngine on
        RewriteCond %{REQUEST_URI} !^public
        RewriteRule ^(.*)$ public/$1 [L]
    </IfModule>
    
    
    重新启动发动机
    重写cond%{REQUEST_URI}^公众的
    重写规则^(.*)$public/$1[L]
    
    我设法让它工作的方法是禁用XAMPP的Apache并运行它

    php artisan serve
    
    现在我可以很好地使用它了


    如果尚未启用调试,请在
    .env
    中启用调试。查看项目的
    laravel.log
    的底部,可能存在一些错误详细信息。您的本地服务器似乎无法提供文件替换
    AllowOverride none
    AllowOverride All
    并重新启动apache@mohammadasghari刚刚测试过,并在httpd.conf和httpd-xampp.conf中将
    AllowOverride none
    更改为
    AllowOverride全部
    。另外,
    Require all denied
    Require all grated
    。您的
    存储/logs/laravel.log中也没有任何内容?这并不能解决问题……总之,您解决了问题,这就够了;)有点这实际上是一种变通方法,因为在Apache之前,它总是在后台运行,我不需要继续执行
    php artisan服务
    。。。现在感觉更像是使用
    ng service
    :P以角度编程
    php artisan event:clear
    
    php artisan cache:clear
    
    php artisan optimize:clear
    
    composer dump-autoload
    
    npm cache clean --force
    
    <IfModule mod_rewrite.c>
        <IfModule mod_negotiation.c>
            Options -MultiViews -Indexes
        </IfModule>
    
        RewriteEngine On
    
        # Handle Authorization Header
        RewriteCond %{HTTP:Authorization} .
        RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    
        # Redirect Trailing Slashes If Not A Folder...
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_URI} (.+)/$
        RewriteRule ^ %1 [L,R=301]
    
        # Handle Front Controller...
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^ index.php [L]
    </IfModule>
    
    <IfModule mod_rewrite.c>
        RewriteEngine on
        RewriteCond %{REQUEST_URI} !^public
        RewriteRule ^(.*)$ public/$1 [L]
    </IfModule>
    
    php artisan serve