Magento 2.3 在本地主机中无法正常工作

Magento 2.3 it's not working properly in localhost

我已经在我的本地主机上安装了 Magento 2.3,并且安装成功。但是当我打开管理员 URL 时,它带有空白 URL。此外,我的主页没有 Magento 默认徽标。我在主页上遇到了另一个问题当我点击创建一个帐户时它重定向成功但它带有一个空白页面。

请参阅附件图片以获得更好的想法。

我认为这个小技巧会对您有所帮助。我记得前段时间我遇到了同样的问题,所以这个问题可能会对你有所帮助。您必须更改 Validator.php 中的一些代码。在 Validator.php 中有一种方法(isPathInDirectories)所以你必须更改下面的行

$realPath = $this->fileDriver->getRealPath($path);

$realPath = str_replace('\', '/', $this->fileDriver->getRealPath($path));

路径:...vendor\Magento\Framework\View\Element\Template\File\Validator.php

@Dhruv 在使用命令 indexing:reindex 后主页完美运行。

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\Admin>cd..

C:\Users>cd..

C:\>cd xampp\php

C:\xampp\php>php C:\xampp\htdocs\Magento3\bin\magento indexer:reindex
Design Config Grid index has been rebuilt successfully in 00:00:06
Customer Grid index has been rebuilt successfully in 00:00:02
Category Products index has been rebuilt successfully in 00:00:03
Product Categories index has been rebuilt successfully in 00:00:00
Catalog Rule Product index has been rebuilt successfully in 00:00:09
Product EAV index has been rebuilt successfully in 00:00:03
Stock index has been rebuilt successfully in 00:00:01
Inventory index has been rebuilt successfully in 00:00:01
Catalog Product Rule index has been rebuilt successfully in 00:00:00
Product Price index has been rebuilt successfully in 00:00:02
Catalog Search index has been rebuilt successfully in 00:00:05

C:\xampp\php>

我在本地主机 - XAMPP 服务器上安装 Magento 2.3.3 时也遇到了同样的问题。它已成功安装,但是当我打开管理面板时,出现如下图所示的空白屏幕。 Admin Panel

解决方案是:

之后,我修改了如下代码。

转到此路径:..\vendor\magento\framework\View\Element\Template\File 然后打开此文件 Validator.php

然后搜索这一行 $realPath = $this->fileDriver->getRealPath($path);

替换为$realPath = str_replace('\', '/', $this->fileDriver->getRealPath($path));

Image for reference to change the Validator.php file

现在管理面板将成功出现。


出现管理面板,但问题是 Magento 徽标未出现在登录屏幕上。登录管理员后 Admin Panel, Icons don't appear on the dashboard also its continuously loading like the below images Icon Don't Appear

解决方法是:

转到此路径:..\app\etc 然后打开此文件 di.xml

然后搜索这一行 Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink

替换行 Magento\Framework\App\View\Asset\MaterializationStrategy\Copy

Check this image for replacing the code & Make sure the code should come like this image

现在转到管理面板并刷新页面。它成功地工作没有问题。所有图标都出现了,Logo也出现了。

Admin Panel Sucess image

现在转到客户区,如果您更新示例内容,页面看起来像这个图像Client Page with Sample Content。否则,它将显示为 "CMS homepage content goes here".

一切正常。

我希望它能用来解决这个问题。