深圳全飞鸿

标题: 关于fastadmin的api部署 [打印本页]

作者: syant    时间: 2025-4-6 11:50
标题: 关于fastadmin的api部署
1、在soluc里执行以下命令
C:\Apache24\htdocs\soluc>php think api --force=true
Build Successed!


生成api.html
可以http://192.168.1.201/soluc/api.html访问

2、在soluc目录下放api.php
  1. <?php

  2. // 深圳全飞鸿Beacon框架C方案API入口
  3. // http://www.nagomes.com

  4. require_once("config.inc.php");
  5. define('APP_PATH', __DIR__ . '/application/');
  6. //define('APP_PATH', dirname(realpath(__DIR__)) . '/application/');
  7. define('APP_SITE', trim($cfg["site_path"], '/'));

  8. // 加载框架引导文件
  9. require __DIR__ . '/../libs/thinkphp5028/base.php';

  10. // 绑定到admin模块
  11. \think\Route::bind('api');

  12. // 关闭路由
  13. \think\App::route(false);

  14. // 设置根url
  15. \think\Url::root('');

  16. // 执行应用
  17. \think\App::run()->send();
复制代码
3、在htdocs根目录放htaccess
在apache的.htaccess中设置,/api/{dynamic_path}访问的是/soluc/api.php/{dynamic_path}
  1. <IfModule mod_rewrite.c>
  2.     RewriteEngine on
  3.     RewriteRule ^api/(.*)$ /soluc/api.php/$1 [L,QSA]
  4. </IfModule>
复制代码
解释:









欢迎光临 深圳全飞鸿 (http://www.nagomes.com/disc/) Powered by Discuz! X3.2