0

I am making a plugin for wordpress that is located at companyname.com/event/countdown/. On this page I would like to dynamically some information from the url string to show a countdown the company can email. So in the url companyname.com/event/countdown/?city?daysleft how can I echo out the city and the days left separately? So on the page it would be:

Event at <?php echo city ?> is <?php echo daysleft ?> days away

I have seen parse_url and $_SERVER['QUERY_STRING'] but I guess I am not fully sure how to get separate parts or build the url.

4

1 回答 1

0

Wordpress 不会停止使用典型的超级全局变量。

在这种情况下,您可以只使用$_GET['city']and $_GET['daysleft']。查询字符串应该格式正确,与您的不同,请注意:

/?city=mycity&daysleft=someinteger
于 2016-02-15T18:54:50.780 回答