PHP displays different content based on different URLs.

Source: Internet
Author: User
PHP displays different content based on different URLs.
I want to get a PHP file like browser browsing:
aa.php?type=1 Display content is 1
Aa.php?type=1&code1=1 Display content is 1-1
aa.php?type=1&code1=1&code2=2 Display content is 1-1-1
Aa.php?type=1&code1=1&code2=2&code3=3 Display content is 1-1-1-1

aa.php?type=2 Display content is 2
Aa.php?type=2&code1=1 Display content is 2-1
aa.php?type=2&code1=1&code2=2 Display content is 2-1-1
Aa.php?type=2&code1=1&code2=2&code3=3 Display content is 2-1-1-1

Just get a PHP file! Can you tell me something? The contents of each parameter display are not the same, and there is no association.


Reply to discussion (solution)

 
  


http://www.huaijiu176.com/aa.php?type=1 Display content is 1
Http://www.huaijiu176.com/aa.php?type=1&code1=1 Display content is 1-1
http://www.huaijiu176.com/aa.php?type=1&code1=1&code2=2 Display content is 1-1-1
Http://www.huaijiu176.com/aa.php?type=1&code1=1&code2=2&code3=3 Display content is 1-1-1-1

http://www.huaijiu176.com/aa.php?type=2 Display content is 2
Http://www.huaijiu176.com/aa.php?type=2&code1=1 Display content is 2-1
http://www.huaijiu176.com/aa.php?type=2&code1=1&code2=2 Display content is 2-1-1
Http://www.huaijiu176.com/aa.php?type=2&code1=1&code2=2&code3=3 Display content is 2-1-1-1

The upper address is a small demo can be opened directly to see ....

Thanks a lot, I'll take a look.

Aa.php?type=1 display content as custom content 1
Aa.php?type=1&code1=1 display content as custom content 2
aa.php?type=1&code1=1&code2=2 display content as custom content 3
Aa.php?type=1&code1=1&code2=2&code3=3 Displaying Custom content 4

aa.php?type=2 display content as custom content 5
Aa.php?type=2&code1=1 display content as custom content 6
aa.php?type=2&code1=1&code2=2 display content as custom content 7
Aa.php?type=2&code1=1&code2=2&code3=3 display content as custom content 8

Actually, that's what I want.

if ($_get[' type ']==1) {

Then there's no more technical content.

Direct 8 x If/elseif

The #3 floor is inconsistent with what you said in the main post, and I don't know which one you want.

Need to be clear what's the same as the product manager hates a will change one

if ($_get[' type ']==1) {
?>
A
}elseif ($_get[' type ']==2) {
?>
B

}elseif ($_get[' type ']==3) {
?>
C

}elseif ($_get[' type ']==4) {
?>
D

}elseif ($_get[' type ']==1 && $_get[' Code1 ']==1) {
?>
E


}elseif ($_get[' type ']==2 && $_get[' Code1 ']==1) {
?>
F
}
?>

But the result of $_get[' type ']==1 && $_get[' Code1 ']==1 is the same as $_get[' type ']==1. I want to be different, I wrote it wrong.



I just want to enter aa.php?type=1 in the browser to display the result is my own definition of content 1

Aa.php?type=1&code1=1 show the result is my own definition of content 2

Aa.php?type=1&code1=1&code2=1 show the result is my own definition of content 3

Content 1 and Content 2 and content 3 are not associated. The content is casual.

Send the Buddha to the West

 These are the old results.
Here are the new requirements
"If ($_get && $_get[' type '] = = 2 && $_get[' code1 '] = = 1 && $_get[' code2 '] = = 2 && $_get[' C Ode3 '] = = 3) {echo "My custom Content 8";} ElseIf ($_get && $_get[' type '] = = 2 && $_get[' code1 '] = = 1 && $_get[' code2 '] = = 2) {echo "My custom content 7"; }elseif ($_get && $_get[' type '] = = 2 && $_get[' code1 '] = = 1) {echo "My custom Content 6";} ElseIf ($_get && $_get[' type '] = = 2) {echo "My custom Content 5";} ElseIf ($_get && $_get[' type '] = = 1 && $_get[' code1 '] = = 1 && $_get[' code2 '] = = 2 && $_get[ ' Code3 '] = = 3) {echo "My custom Content 4";} ElseIf ($_get && $_get[' type '] = = 1 && $_get[' code1 '] = = 1 && $_get[' code2 '] = = 2) {echo "My custom content 3"; }elseif ($_get && $_get[' type '] = = 1 && $_get[' code1 '] = = 1) {echo "My custom content 2";} ElseIf ($_get && $_get[' type '] = = 1) {echo "My custom content 1";}? >


The trick is to keep the possibility of not repeating the front line.

Need to be clear what's the same as the product manager hates a will change one

Ask the big coffee to help me to see the soapclient unsuccessful question Thank you

Thank you, good man.

Ask the big coffee to help me to see the soapclient unsuccessful question Thank you
SoapClient, you asked Mr. Xu to see what he should know.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.