【发布时间】:2020-09-15 05:54:30
【问题描述】:
你好,发布后我的网站出现了一些错误。当我在 localhost 中使用时,我的网站没有出现错误,但是当我发布到主机时出现错误。名为“找不到类'App\link'”的错误。该代码与我在本地主机中的代码没有什么不同。我该如何解决? 这里有一些关于 public_html/app/Http/Controllers/Backend/LinkController.php 的代码
<?php
namespace App\Http\Controllers\Backend;
use Illuminate\Http\Request;
use App\link;
use App\User;
use Auth;
use Intervention\Image\Facades\Image;
use Carbon\Carbon;
use App\Website;
class LinkController extends BackendController
{
public function index()
{
$website = Website::get();
$link = Link::get();
return view("backend.link.index", compact('link', 'website'));
}
和/public_html/app/Link.php
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Link extends Model
{
protected $fillable = ['judul', 'url', 'jenis_id', 'user_id'];
public function user()
{
return $this->belongsTo(User::class);
}
public function dateFormatted($showTimes = false)
{
$format = "d/m/Y";
if ($showTimes) $format . "H:i:s";
return $this->created_at->format($format);
}
}
请帮忙
【问题讨论】:
-
错字:
use App\link!=use App\Link... -
@jibsteroos 为什么它在 localhost 中不起作用?
-
因为某些系统实际上具有区分大小写的文件系统(您应该始终假设大小写很重要,那么您就不会有任何问题)