我正在尝试使用Slim3与PHP和mySQL创建一个Web服务。当我尝试连接到此Web服务时,浏览器和邮递员返回“找不到页面”
这是我的index.php
$app->get('/teste', function (Response $response) use ($app) {
$response->getBody()->write("Fuck off");
return $response; });
$app->post('/createuser' , function () use ($app) {
verifyRequiredParams(array('first_name', 'last_name', 'username', 'password'));
$response = array();
$first_name = $app->request->post('first_name');
$last_name = $app->request->post('last_name');
$username = $app->request->post('username');
$password = $app->request->post('password');
$db = new DbOperation();
$res = $db->createUser($first_name, $last_name, $username, $password);
if($res == 0) {
$response["error"] = false;
$response["message"] = "User created";
echoResponse(201, $response);
} else if($res == 1) {
$response["error"] = true;
$response["message"] = "Oops, error while creating a user";
echoResponse(200, $response);
} else if($res == 2) {
$response["error"] = true;
$response["message"] = "E-mail already exist";
echoResponse(200, $response);
} });
这是我的.htaccess
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]
我知道问题不是apache,因为我在目录中创建了一个php文件并且工作正常。
任何人都可以帮助我吗?
由于