更新结束 - 已解决的问题
问题是我的服务器设置不正确,因为域没有正确连接到我的VPS。与托管服务提供商联系并解决问题。
如果有人遇到此问题,请检查
php artisan config:cache
或php artisan
config:clear
?yourview.blade.php
?resources\views
?我已将laravel应用程序部署到我的VPS中。它在localhost上运行正常。 错误消息如下所示:
InvalidArgumentException in FileViewFinder.php line 137:
View [index] not found.
1. in FileViewFinder.php line 137
2. at FileViewFinder->findInPaths('index', array('E:\Laravel\portofolio\resources\views')) in FileViewFinder.php line 79
3. at FileViewFinder->find('index') in Factory.php line 174
4. at Factory->make('index', array(), array()) in helpers.php line 856
5. at view('index') in Portofolio.php line 56
6. at Portofolio->link()
7. at call_user_func_array(array(object(Portofolio), 'link'), array()) in Controller.php line 55
在错误消息的第2行中,您可以看到它仍在本地目录中。我尝试过使用
php artisan config:clear|cache
php artisan view:clear
php artisan route:cache
php artisan optimize
甚至没有一个人解决了这个问题。这是php artisan config:cache
之后配置文件中的视图部分,你可以看到它已经使用了VPS目录
'view' =>
array (
'paths' =>
array (
0 => '/home/wahyuhan/portofolio/resources/views',
),
'compiled' => '/home/wahyuhan/portofolio/storage/framework/views',
),
也许问题出现在我的路线或控制器页面中,但我似乎无法找到问题。服务器操作系统是CentOS,我已经读过CentOS区分大小写但是我在这里看不到任何区分大小写的问题。
这是我的服务器目录
Root
|-- portofolio
|-- app
|-- bootstrap
|-- config
|-- database
|-- resources
|-- assets
|-- lang
|-- views
|-- index.blade.php
|-- routes
|-- storage
|-- tests
|-- vendor
|-- public_html
|-- css
|-- img
|-- js
|-- vendor
这是我的 ROUTE
Route::get('/', ['as' => 'home', 'uses' => 'Portofolio@link']);
这是我的 CONTROLLER
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class Portofolio extends Controller
{
public function link() {
$categories = [
'1' => 'Print Design',
'2' => 'Logo Design',
'3' => 'Web Design',
'4' => 'Product Design',
'5' => 'Character Design',
'6' => 'Packaging Design'
];
$projects = [
'1' => 'IMSAA Training Certificate',
'2' => 'Rusticity Logo',
'3' => 'Handy Production Website',
'4' => 'Nihon no Matsuri Bag Project',
'5' => 'The Chin - Captain Jack Sparrow',
'6' => 'Rusticity Packaging'
];
$images = [
'1' => '1',
'2' => '2',
'3' => '3',
'4' => '4',
'5' => '5',
'6' => '6'
];
$skills = [
'1' => 'Photoshop',
'2' => 'Ms. Office',
'3' => 'Laravel',
'4' => 'PHP',
'5' => 'HTML',
'6' => 'MySQL'
];
$points = [
'1' => '80%',
'2' => '90%',
'3' => '60%',
'4' => '60%',
'5' => '60%',
'6' => '60%'
];
return view('index')->withCategories($categories)->withProjects($projects)->withImages($images)->withSkills($skills)->withPoints($points);
}
}
任何建议?
答案 0 :(得分:0)
问题是我的服务器设置不正确,因为域没有正确连接到我的VPS。与托管服务提供商联系并解决问题。
如果有人遇到此问题,请检查
php artisan config:cache
或php artisan
config:clear
?yourview.blade.php
?resources\views
?