التحميل التلقائي
إذا لم يقم مشروعك بتنفيذ التحميل التلقائي، يمكنك استخدام composer لإنشاء واحد، والخطوات كالتالي.
1. تغيير composer.json
في composer.json، أضف "" : "./" إلى autoload.psr-4، على سبيل المثال
{
"require": {
"workerman/workerman" : "^v4.0.0"
},
"autoload": {
"psr-4": {
"" : "./"
}
}
}
2. إنشاء autoload.php
نفذ composer dumpautoload
3. تحميل autoload.php
في رأس مشروع start.php، قم بتحميل vendor/autoload.php، على سبيل المثال
<?php
require_once __DIR__ . '/vendor/autoload.php';
4. إعادة تشغيل workerman
php start.php restart