Kontrolcü
PSR4 standardına göre, kontrolcü sınıfı ad alanı plugin\{eklenti kimliği}
ile başlar, örneğin
Yeni kontrolcü dosyası oluşturun plugin/foo/app/controller/FooController.php
dosyasını.
<?php
namespace plugin\foo\app\controller;
use support\Request;
class FooController
{
public function index(Request $request)
{
return response('hello index');
}
public function hello(Request $request)
{
return response('hello webman');
}
}
http://127.0.0.1:8787/app/foo/foo
adresine erişildiğinde, sayfa hello index
döner.
http://127.0.0.1:8787/app/foo/foo/hello
adresine erişildiğinde, sayfa hello webman
döner.
url erişimi
Uygulama eklenti URL adres yolları /app
ile başlar, ardından eklenti kimliği gelir, ardından belirli kontrolcü ve yöntem gelir.
Örneğin plugin\foo\app\controller\UserController
URL adresi http://127.0.0.1:8787/app/foo/user
dır.