문제

My current address is: http://localhost/bookstore/bookedit.php?book_id=12

The $_SERVER['PHP_SELF'] variable is a string '/bookstore/bookedit.php',

But I would like to get the string 'bookedit.php?book_id=12',

Do we have any function or variable can do this?

Thanks!

도움이 되었습니까?

해결책

If you do a var_dump($_SERVER) you will see all of the server variables you have available to you

$_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'];

다른 팁

You can use the Request URI variable.

$_SERVER['REQUEST_URI']

$data = basename($_SERVER['PHP_SELF']);
$data .= $_SERVER['QUERY_STRING'] ? '?' . $_SERVER['QUERY_STRING'] : '';
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top