English 中文(简体)
部分域名摘取
原标题:Extracting part of a domain name

我有一位成员,<代码>,即成员。

例如http:// members.exampledomain.com。 指数页像

    <img src="members/images/logoexampledomain.png" />
问题回答

使用:

print_r($_SERVER);

并且看是否有你喜欢的东西:

如果是所有途径,则你可以使用$pieces = 考察( ,美元;$pieces***

如果你不做这项工作,我就使用java书写字,然后在无法运行的网页上从斜体中提取信息。 我认为,我用窗子检索了这一信息。 地点和职能显示,检查点的特性是什么,因此,它知道哪里会分红灯或检索你想要的信息。

如果你希望按上文所建议的领域这样做,那么以下法典应当为你工作。

 $full_domain =  members.example.com ;
 $parts = explode( . , $full_domain);
 array_slice($parts, -2, 2);
 $domain = implode( . , $parts);
 echo $domain;

这是该领域的一个基本支柱。 当你在同一个文字上使用多个领域(aka虚拟主机)时,情况就更加复杂,这些领域的延伸程度各不相同,例如:com.au。

如果希望获得该领域的成员部分,可在上述法典之后添加以下法典:

 $member = rtrim(str_replace($domain,   , $full_domain),  . );
 echo $member;




相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签