Skip to content

Commit 117c995

Browse files
committed
fix: 404 not return bug fix
1 parent b4c73a9 commit 117c995

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

lib/phpExpress.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ private function removePhpUrl($url)
7474
*/
7575
private function convertParm($parm)
7676
{
77+
// If Same parm
78+
if (strcmp($_SERVER['REQUEST_URI'], $parm)) {
79+
return $parm;
80+
}
81+
7782
$replaceParm = $parm;
7883
$count = preg_match_all('/{/u', $parm);
7984
for ($dataEnd = 0, $end = 0, $i = 0; $i < $count; ++$i) {

test/get.test.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33

44
$app = new phpExpress();
55

6-
// Request : http://localhost:3000/test/get.test.php/3/r/good/d
7-
// Result : 3rd
8-
$app->get('/{id}/{text}/good/{text2}', static function ($req) {
6+
// Request : http://localhost:3000/test/get.test.php/3/get
7+
// Result : 3
8+
$app->get('/{id}/get', static function ($req) {
99
try {
10-
return $req["id"] . $req["text"] . $req["text2"];
10+
return $req["id"];
1111
} catch (Exception $e) {
1212
http_response_code(500);
1313
return $e;

0 commit comments

Comments
 (0)