<?php
switch(connection_status())
{
case CONNECTION_NORMAL:
$txt = 'Connection is in a normal state';//连接运行正常
break;
case CONNECTION_ABORTED:
$txt = 'Connection aborted';//连接由用户或网络错误终止
break;
case CONNECTION_TIMEOUT:
$txt = 'Connection timed out';// 连接超时
break;
case (CONNECTION_ABORTED & CONNECTION_TIMEOUT):
$txt = 'Connection aborted and timed out';
break;
default:
$txt = 'Unknown';//未知错误
break;
}
echo $txt;
<?php
define("GREETING","Hello world!");//定义常量
echo constant("GREETING");//输出常量
<?php
define("GREETING","Hello world!",true);//定义常量,不区分大小写
echo constant("greeting");//输出常量
<?php
define("GREETING","Hello world!");
echo defined("GREETING");//判断常量是否存在
<?php
$site = "666";
fopen($site,"r")
or die("Unable to connect to $site");//输出信息,并推出当前程序
echo "66666448";
?>
<?php
$string = "beautiful";
$time = "winter";
$str = 'This is a $string $time morning!';
echo $str. "<br />";
eval("\$str=\"$str\";");//必须以分号;结束,不然会报错
echo $str;
<?php
$site="6666";
fopen($site,"r")
or exit("Unable to connect to $site");
<?php
echo $_SERVER['HTTP_USER_AGENT'];
$browser=get_browser(null,true);//返回浏览器的性能
print_r($browser);
<?php
echo date('h:i:s');
sleep(10);
echo "<br />";//耐心等十秒
echo date('h:i:s');
<?php
echo uniqid();//刷新都会变.以微秒计的当前时间,生成一个唯一的 ID。
<?php
echo date('h:i:s') . "<br />";
//延迟 10 描述
usleep(10000000);//一微秒等于百万分之一秒。
//再次开始
echo date('h:i:s');
?>