$request = '/test.php?action=save&key=e7s2uHhKKtcM32cHKUKM&login=test';
$param = preg_match("#^test.php?action=save&key=(\w+)&login=(\w+)($)#", $request, $match);
print_r($param);
It's not working. How to fix?
$request = '/test.php?action=save&key=e7s2uHhKKtcM32cHKUKM&login=test';
$param = preg_match("#^test.php?action=save&key=(\w+)&login=(\w+)($)#", $request, $match);
print_r($param);
It's not working. How to fix?
.
" and "?
"^test
meaning the string should start with "test
", while your string starts with "/test
"I highly recommend to use single ticks so you don't have to escape your escape characters "\
".
$param = preg_match('#^/test\.php\?action=save&key=(\w+)&login=(\w+)($)#', $request, $match);
print_r($param); // 1
print_r($match); // Array (
// (
// [0] => /test.php?action=save&key=e7s2uHhKKtcM32cHKUKM&login=test
// [1] => e7s2uHhKKtcM32cHKUKM
// [2] => test
// [3] =>
// )