我想在不使用GET的情况下从url传递数据并使用PHP在页面上显示 [英] I want to pass data from url without using GET and display on the page using PHP
本文介绍了我想在不使用GET的情况下从url传递数据并使用PHP在页面上显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,我想传递像firstname这样的数据,例如http://mywebsite.com/erick,而不是使用http://mywebsite.com/index.php?name=erick,并在页面上显示第一个名称。任何人都知道如何做到这一点,我需要帮助。
我尝试过:
<?php
if($ _ GET [name]){
print $ _GET [name];
}
else {printWelcome,Guest; }
?>
Hi there, I want to passing data like firstname for example http://mywebsite.com/erick instead of using http://mywebsite.com/index.php?name=erick, and display the firstname on the page. Anyone know how to do that please I need help.
What I have tried:
<?php
if($_GET["name"]){
print $_GET["name"];
}
else{ print "Welcome, Guest"; }
?>
推荐答案
_GET [name]){
_GET["name"]){
_GET [name];
}
else {printWelcome,Guest; }
?>
_GET["name"];
}
else{ print "Welcome, Guest"; }
?>
PHP as-is无法处理这种URL格式(MVC也使用路由器来解决它),但有PHP的MVC实现 - go和Google一个给你...
PHP as-is can not handle such URL formats (MVC too uses a router to solve it), but there are MVC implementations for PHP - go and Google one for you...
这篇关于我想在不使用GET的情况下从url传递数据并使用PHP在页面上显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文