Laravel 5.4路线不起作用

时间:2017-07-10 08:20:11

标签: php laravel laravel-5 url-routing

我是Laravel的新人。我使用Laravel 5.4。

我的路线文件是:

Route::get('/', function () {
    return view('welcome');
});

Auth::routes();
Route::group(['middleware' => 'auth'], function () {
    Route::group(['prefix' => 'admin'], function () {
        Route::get('/', 'HomeController@index')->name('dashboard');
        Route::get('home', 'HomeController@index')->name('home');
        Route::get('/users', 'UserController@index')->name('users');
    });
});

当我在浏览器admin/home中使用网址时,它正常工作,但当我使用admin/时,它会将我重定向到欢迎页面。

当我使用网址http://appurl/admin/时它根本不起作用,但是当我使用http://appurl/admin/home时它正在工作 当我错了?

MY Home Controller ::

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class HomeController extends Controller
{
    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        //$this->middleware('auth');
    }

    /**
     * Show the application dashboard.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        return view('admin/dashboard');
    }
}

当我删除它时,我注意到了:

Route::get('/', function () {
    return view('welcome');
});

我将为http://appurl/admin/

工作

1 个答案:

答案 0 :(得分:0)

在回家之前你遗失了tr

import Queue
import threading
import multiprocessing
import time
import psutil


class ThreadSomething(threading.Thread):
    def __init__(self, queue):
        threading.Thread.__init__(self)
        self.queue = queue

    def run(self):
        while True:
            # check available memory
            virtualMemoryInfo = psutil.virtual_memory()
            availableMemory = virtualMemoryInfo.available

            print(str(availableMemory/1025/1024)+"M")

            if availableMemory > MEMORY_WARNING:
                # image from queue
                image = self.queue.get()

                # do something
                doSomething(image)

                # signals to queue job is done
                self.queue.task_done()
            else:
                print("memory warning!")

def doSomething(image):
    # picture processing code, cost time and memory
    print("processing over")

# After testing, there seems no use to create threads more than CPU_COUNT, 
# execution time is not reduce.
CPU_COUNT = multiprocessing.cpu_count()
MEMORY_WARNING = 200*1024*1024  # 200M

images = ["1.png", "2.png", "3.png", "4.png", "5.png"]
queue = Queue.Queue()

def main():
    # spawn a pool of threads, and pass them queue instance
    for i in range(CPU_COUNT):
        t = ThreadSomething(queue)
        t.setDaemon(True)
        t.start()

    # populate queue with data
        for image in images:
            queue.put(image)

    # wait on the queue until everything has been processed
    queue.join()

start = time.time()
main()
print 'All over. Elapsed Time: %s' % (time.time() - start)

但我有点困惑。为什么要两次调用相同的函数CPU_COUNT