douan1893 2016-11-14 14:48
浏览 165
已采纳

在没有composer dump-autoload的Laravel中加载自定义php文件

I'm new in Laravel. I've been followed few threads of how to load custom php library to Laravel 4,2 without dump autoload. So far I'm unable or I calling the function incorrect.

What I have so far is:

  1. I file autoload_classmap.php I've added my class

    'ImageResize' => $baseDir . '/app/libraries/ImageResize.php',

  2. In file autoload_static.php I've added

    'ImageResize' => __DIR__ . '/../..' . '/app/libraries/ImageResize.php',

Then in my controller in the function where I want to be shown this class I've tried like this

public function upload() {

$FmyFunction1 = new \ImageResize(); 
    return View::make('site.admin.upload', [
        'FmyFunction1' => $FmyFunction1
    ]);
}

Result is when I try to load /upload page I've got error:

'Class 'ImageResize' not found'

Is this error from wrong calling the class and/or error from not include correctly the class in Laravel at all? Can anyone help me?

ps. The reason I can't use dump autoload is because I have only ftp access to the host and I don't have SSH...

  • 写回答

2条回答

      报告相同问题?

      相关推荐 更多相似问题

      悬赏问题

      • ¥15 vue3为什么请求在这边获取不到数据呢(关键词-select)
      • ¥20 Multisim仿真设计三路智力抢答装置
      • ¥15 用UML制作简单的语音计算机
      • ¥20 用socket实现ping遇到的问题
      • ¥15 综合的类,这个类里面里面又有构造方法,重载方法,有继承,有重写,有接口
      • ¥15 电脑重置失败无法开机也进不了修复模式,如何解决?
      • ¥100 px4飞控如何设置平飞模式下飞机固定的仰角
      • ¥15 关于#python#的问题:不可以使用max ,min ,exit ,break 的情况下找出哪一年份出生率最高,以及哪一年份出生率最低
      • ¥15 WPF中使用DoDragDrop程序会崩,"FatalExecutionEngineError"
      • ¥15 C语言 堆排序 数据结构