php - 网址路由不起作用 Rest Api codeigniter
问题描述
我正在使用codeigniter创建rest api并想使用函数,但是在点击“ http://localhost/codeigniter-rest-api-master/api/testing ”后显示错误“404 page not found”。我错了?
这是我的“应用程序/配置/routes.php”
$route['api'] = 'api/users/';
//api/users
$route['api/users'] = 'api/testing/testing/';
$route['api/users/format/json'] = 'api/testing/testing/format/json';
$route['api/users/format/xml'] = 'api/testing/testing/format/xml';
$route['api/users/format/html'] = 'api/testing/testing/format/html';
$route['api/users/format/csv'] = 'api/testing/users/format/csv';
$route['api/users.json'] = 'api/testing/testing.json';
$route['api/users.xml'] = 'api/testing/testing.xml';
$route['api/users.html'] = 'api/testing/testing.html';
$route['api/users.csv'] = 'api/testing/testing.csv';
这是我的“应用程序/控制器/api/Users.php”
public function testing()
{
echo "hello world";
}
解决方案
推荐阅读
- protractor - 术语“量角器”未被识别为 cmdlet 的名称
- mysql - 我有数据库备份,我正在导入另一个 mysql 服务器,它导入数据库时出现错误 1064
- ionic3 - 带画布的离子水平滚动
- python - 将 Django 应用程序部署到 Heroku 但 Heroku pip install 找不到与 requirements.txt 匹配的模块版本
- python - 使用 Gensim 更新 TF-IDF
- python - 将数据框中的字符串值拆分为 numpy 浮点值
- javascript - 显示具有不同值的变量
- tcl - 如何处理期望块内的不同输出
- ios - 无法使用区域和语言的某些组合将字符串转换为双精度
- sass - 导入一个不导入该文件的 SASS 文件