您好,发布后我的网站出现了一些错误。当我在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);
}
}
请帮助
答案 0 :(得分:0)
将第一个字母用户的“链接”更改为大写 更改此使用App \ link;
使用此应用\ Link;
答案 1 :(得分:0)
只是输入错误,请更改链接
use App\link;
进入
use App\Link;