E
E
evilelf2016-07-15 07:55:54
Yii
evilelf, 2016-07-15 07:55:54

How to get GET data after a trellis?

Hello.
It is necessary to get the GET-data field of the lattice.
Link example: site.ru#data1=test&data2=test2
How can I find out what parameters are in this link using php?
$_GET, $_REQUEST, $_SERVER['QUERY_STRING'] - empty

Answer the question

In order to leave comments, you need to log in

3 answer(s)
G
Grigory Esin, 2016-07-15
@evilelf

1. This is not get data. It's called a "fragment"
2. Browsers don't send a fragment to the server, so there's basically no way to fetch it in the puff.
3. You can get a fragment in JS and send it to the server with an AJAX request.
4. Or use JS to create a new url and redirect to it.
5. A fragment in this format is usually intended to be processed by JS.

P
Pogran, 2016-07-15
@Pogran

У вас запрос не правильный поэтому и не получаете ничего. Нужно запрос делать не через # , а через ? . Т.е должно быть site.ru?data1=test&data2=test2 , а не site.ru#data1=test&data2=test2 .
Также с помощью yii2 можно получить параметры через функцию Yii::$app->request->get() или Yii::$app->request->get('data1') - получите то что в data1

6
65536, 2016-07-15
@65536

никак

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question