If I have a url that looks like that, the best way to read the value
http://www.domain.com/compute?value=2838
I tried parse_url(), but it gives me value=2838not2838
parse_url()
value=2838
2838
Edit: Note that I'm talking about a string, not a current url. I have a url stored in a string.
You can use parse_urland then parse_strin the request.
parse_url
parse_str
<?php $url = "http://www.domain.com/compute?value=2838"; $query = parse_url($url, PHP_URL_QUERY); $vars = array(); parse_str($query, $vars); print_r($vars); ?>
Print
Array ( [value] => 2838 )
For http://www.domain.com/compute?value=2838you must use $_GET['value']to return 2838
$_GET['value']
$uri = parse_url($uri); parse_str($uri['query'], $params = array());
, parse_str() . script!
parse_str ($ url) $value = 2838.
. http://php.net/manual/en/function.parse-str.php
GET,
echo "value = ".$_GET['value'];
Source: https://habr.com/ru/post/1778715/More articles:дифференцировать запрос Flash и запрос, поступив из адресной строки браузера, - javascriptThe implementation of "*?" (lazy "*") regex pattern in GLR combinators - language-agnosticHow can I compile my Windows program into a single Linux file that works with Wine? - linuxgit: removing changes made by a number of bad commits - gitОтображается Unicode с именем Folder? в приглашении wscript - unicodeGetting vars from URL - urlотправка большого количества электронной почты в модуль рассылки новостей - phphow can i set the value marked in ListPreference - androidHow to increase productivity AJAX - performanceHibernate request causing unnecessary unnecessary requests - javaAll Articles