FastAdmin Installation, Configuration, and Common Issue Resolution Guide
This tutorial walks through installing FastAdmin, customizing its backend template, adding CRUD modules, designing the database schema, handling CORS 403 errors, fixing category display issues, and addressing various configuration pitfalls, providing step‑by‑step code examples for PHP developers.
Introduction: This article records the author's experience installing and configuring FastAdmin, a PHP backend admin framework, and solving common problems.
Installation: Download the source from fastadmin.net, extract it, place it in the PHP environment, configure a virtual host, ensure PHP >= 7.1 < 7.3, MySQL >= 5.5, required extensions, then access www.fast.com/install.php to set up the database.
Configuration: Remove unnecessary menus (e.g., plugin management) by editing the code and using the backend menu manager; delete plugin code directories and adjust menu entries accordingly.
Adding modules: Use ThinkPHP commands such as php think crud -t picture -u 1 to generate CRUD modules, with examples for nested modules ( php think crud -t video -c video/video -u 1) and camel‑case modules ( php think crud -t video_subject -c video/videoSubject -u 1).
Database design: Explain field types like image (single image), images (multiple images), createtime, updatetime, text, weigh and their automatic handling in FastAdmin.
Handling 403 errors: Add CORS headers in the API base class, for example:
header("Access-Control-Allow-Methods: *");
header('Access-Control-Allow-Origin: 域名');
header("access-control-allow-credentials: true");
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
header('Access-Control-Allow-Headers:x-requested-with,content-type,token,userid,laravelsession');
exit("ok");
}Fixing list page showing category IDs: Use a ThinkPHP accessor in the model or enable protected $relationSearch = true; and rewrite the controller index method to join the category relation, then adjust the JS column definition.
Other issues: Resolve add/edit failures caused by fields ending with _id, display Chinese field names by editing language packs, customize buttons and recycle‑bin functionality by modifying JS and template files, ensure enum fields render as radio buttons by naming them with a data suffix, and refresh data after AJAX actions by setting refresh:true on the button.
Conclusion: The guide provides step‑by‑step solutions for FastAdmin setup and common pitfalls, encouraging readers to comment for further assistance.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
php Courses
php中文网's platform for the latest courses and technical articles, helping PHP learners advance quickly.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
