কন্ট্রোলার
PSR4 মান অনুযায়ী, কন্ট্রোলার ক্লাসের নামস্থান plugin\{প্লাগিন চিহ্ন}
দিয়ে শুরু হয়, উদাহরণস্বরূপ
নতুন কন্ট্রোলার ফাইল তৈরি করুন plugin/foo/app/controller/FooController.php
।
<?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
দেখা হয়, তখন পৃষ্ঠা hello index
ফেরত দেয়
যখন http://127.0.0.1:8787/app/foo/foo/hello
দেখা হয়, তখন পৃষ্ঠা hello webman
ফেরত দেয়
url প্রবেশ
অ্যাপ্লিকেশন প্লাগিনের URL ঠিকানা পাথ সবসময় /app
দিয়ে শুরু হয়, তারপরে প্লাগিন চিহ্ন থাকে, তারপর নির্দিষ্ট কন্ট্রোলার এবং পদ্ধতি। উদাহরণস্বরূপ, plugin\foo\app\controller\UserController
এর URL ঠিকানা হল http://127.0.0.1:8787/app/foo/user