[SOLVED] F7[v2] How to pass query value to web server?


#1

routes:
{
path: ‘/news’,
url: ‘/web/news.php’,
}

when we visit url: www.domain.com/news?id=5
we can use js:

this.$route.query.id

get the query value:5.

but php can not get the value,how can I get the query id?


#2

Hi @woxiangfy,

Are questioning that how to get query parameter value in php?

If so, then you are in wrong forum.


#3

when I visit: bhlc.allPatient?id=5

F7 just visit:bhlc.allPatient

I want request URL with ?id=5,so I can use php get the query value。


#6

You can get the parameters of your URL through PHP with the following class: http_get ().

Example.

<? php

$ response = http_get ("http://www.example.com/", $ info);

var_dump ($ info);

?>

More details on:

http://php.net/manual/fa/function.http-get.php

Hope this helps. :smiley: Happy New Year.


#7

Maybe you above don’t understand what I mean. I modified the source code to achieve my needs(add in red box)

This may explain what I need.Thank you :grinning:


#8

PHP can not get values, because Framework7 sent only “/web/news.php” without any GET variables.

I cat’n find a solution too.


#9

YES! So I wish the author add one set to enable this Function, that I don’t need to modify the original code.


#10

You can try to use Async route in v2 and add query parameters depending on requested route http://framework7.io/docs/routes.html#async-route


[SOLVED]How to send variables from one page to another?
#11

thank you! It works,my code is


#12

i am new to this form. i know this issue has been closed but i think i have a better solution to pass query values to a webserver.

this is how i solved it:
the link is:
/blog/11-2-2018/
the route is:
{
path: ‘/blog/:date’,
templateUrl: ‘./pages/blog.php?date={{this.$route.params.date}}’,
},

and print_r($_GET) in blog.php prints out:
Array ( [date] => 11-2-2018 )

is this what you meant?