window .location = "$PHP_SELF";"; 방법 3: echo " window .location = "$PHP_SELF";"; 방법 3: echo "

 >  기사  >  백엔드 개발  >  nba2k 온라인 C 기술 여러 PHP 응용 기술

nba2k 온라인 C 기술 여러 PHP 응용 기술

WBOY
WBOY원래의
2016-07-29 08:37:42895검색

1. PHP 리디렉션 정보
1. PHP 리디렉션 정보
방법 1: header("Location: index.php")
방법 2: echo "window.location ="$ PHP_SELF" ;";
방법 3: echo "2. 방문자의 브라우저를 가져옵니다
function browser_infor()
{
$browser="";$browserver="";
$Browsers =array("Lynx","MOSAIC","AOL","Opera","JAVA","MacWeb","WebExplorer" ,"OmniWeb ");
$Agent = $GLOBALS["HTTP_USER_AGENT"];
for ($i=0; $i<=7; $i )
{
if (strpos( $Agent, $Browsers[$i]))
{
$browser = $Browsers[$i]
$browserver =""
}
}
if ( ereg(" Mozilla",$Agent) && !ereg("MSIE",$Agent))
{
$temp =explode("(", $Agent); $Part=$temp[0];
$temp =explode("/", $Part); $browserver=$temp[1];
$temp =explode(" ",$browserver); browserver =preg_replace("/([d.] )/","1",$browserver);
$browserver = " $browserver";
$browser = "Netscape Navigator"
} 🎜>if (ereg("Mozilla",$Agent) && ereg("Opera",$Agent))
{
$temp =explode("(", $Agent); $Part= $temp[ 1]; $temp =explode(")", $Part); $browserver=$temp[1]
$temp =explode(" ",$browserver);$browserver=$ 임시[2 ];
$browserver =preg_replace("/([d.] )/","1",$browserver)
$browserver = " $browserver"
$browser = " 오페라";
}
if (ereg("Mozilla",$Agent) && ereg("MSIE",$Agent))
{
$temp =Explode("(", $Agent ); $ 부품=$temp[1]
$temp = 폭발(";",$Part) $Part=$temp[1]
$temp = 폭발(" ",$Part) ;$browserver =$temp[2]
$browserver =preg_replace("/([d.] )/","1",$browserver)
$browserver = " $browserver"; = "Internet Explorer";
}
if ($browser!="")
{
$browseinfo = "$browser$browserver"
}
else
{
$browseinfo = "Unknown";
}
return $browseinfo;
}
//$browser=browseinfo() 메소드 호출
3 , 방문자의 운영체제를 가져옵니다.
function osinfo() {
$os="";
$Agent = $GLOBALS["HTTP_USER_AGENT"]
if (eregi('win',$Agent ) && strpos($Agent, '95')) {
$os="Windows 95";
}
elseif (eregi('win 9x',$Agent) && strpos($Agent, ' 4.90 ')) {
$os="Windows ME";
}
elseif (eregi('win',$Agent) && ereg('98',$Agent)) {
$ os ="Windows 98";
}
elseif (eregi('win',$Agent) && eregi('nt 5.0',$Agent)) {
$os="Windows 2000"; >}
elseif (eregi('win',$Agent) && eregi('nt',$Agent)) {
$os="Windows NT"
}
elseif (eregi ( 'win',$Agent) && eregi('nt 5.1',$Agent)) {
$os="Windows XP"
}
elseif (eregi('win',$Agent) && ereg('32',$Agent)) {
$os="Windows 32";
}
elseif (eregi('linux',$Agent)) {
$os=" Linux ";
}
elseif (eregi('unix',$Agent)) {
$os="Unix";
}
elseif (eregi('sun',$Agent) ) && eregi('os',$Agent)) {
$os="SunOS"
}
elseif (eregi('ibm',$Agent) && eregi('os',$Agent) )) {
$os="IBM OS/2";
}
elseif (eregi('Mac',$Agent) && eregi('PC',$Agent)) {
$ os="Macintosh";
}
elseif(eregi('PowerPC',$Agent)) {
$os="PowerPC"
}
elseif('AIX' ,$Agent)) {
$os="AIX";
}
elseif (eregi('HPUX',$Agent)) {
$os="HPUX"
}
elseif (eregi('NetBSD',$Agent)) {
$os="NetBSD";
}
elseif (eregi('BSD',$Agent)) {
$ os="BSD";
}
elseif(ereg('OSF1',$Agent)) {
$os="OSF1"
}
elseif('IRIX' ,$Agent)) {
$os="IRIX";
}
elseif (eregi('FreeBSD',$Agent)) {
$os="FreeBSD"
}
if ($os=='') $os = "알 수 없음"
$os 반환
}
//사용방법$os=os_infor() ;
4、文件格式类
$mime_types = array( 
'gif' => 'image/gif', 
'jpg' => 'image/jpeg', 
' jpeg' =>  '이미지/jpeg', 
'jpe' =>  '이미지/jpeg', 
'bmp' =>  '이미지/bmp', 
'png' => '이미지/png', 
'tif' =>  '이미지/tiff', 
'tiff' =>  '이미지/tiff', 
'pict' => '이미지/x- pict', 
'pic' =>  'image/x-pict', 
'pct' =>  'image/x-pict', 
'tif' => '이미지/tiff ', 
'tiff' =>  'image/tiff', 
'psd' =>  'image/x-photoshop', 
'swf' =>  'application/x-shockwave- flash', 
'js' =>  'application/x-javascrīpt', 
'pdf' =>  'application/pdf', 
'ps' =>  'application/postscrīpt',
'eps' =>  'application/postscrīpt', 
'ai' =>  'application/postscrīpt', 
'wmf' =>  'application/x-msmetafile',
'css' =>  '텍스트/css', 
'htm' =>  'text/html', 
'html' =>  'text/html', 
'txt' ;  'text/plain', 
'xml' =>  'text/xml', 
'wml' =>  'text/wml', 
'wbmp' => '이미지/vnd .wap.wbmp', 
'mid' =>  '오디오/미디', 
'wav' => '오디오/wav', 
'mp3' => '오디오/mpeg', 
'mp2' => '오디오/mpeg', 
'avi' => 'video/x-msvideo', 
'mpeg' => '비디오/mpeg', 
'mpg' => '비디오/mpeg', 
'qt' => '동영상/퀵타임', 
'mov' => '동영상/퀵타임', 
'lha' => 'application/x-lha', 
'lzh' => 'application/x-lha', 
'z' => 'application/x-compress', 
'gtar' => 'application/x-gtar', 
'gz' => 'application/x-gzip', 
'gzip' => 'application/x-gzip', 
'tgz' => 'application/x-gzip', 
'tar' => 'application/x-tar', 
'bz2' => 'application/bzip2', 
'zip' => 'application/zip', 
'arj' => 'application/x-arj', 
'rar' => 'application/x-rar-compressed', 
'hqx' => 'application/mac-binhex40', 
'앉아' => 'application/x-stuffit', 
'bin' => 'application/x-macbinary', 
'uu' => 'text/x-uuencode', 
'uue' => 'text/x-uuencode', 
'latex'=> 'application/x-latex', 
'ltx' => 'application/x-latex', 
'tcl' => 'application/x-tcl', 
'pgp' => 'application/pgp', 
'asc' => '응용 프로그램/pgp', 
'exe' => 'application/x-msdownload', 
'doc' => 'application/msword', 
'rtf' => 'application/rtf', 
'xls' => 'application/vnd.ms-excel', 
'ppt' => 'application/vnd.ms-powerpoint', 
'mdb' => 'application/x-msaccess', 
'wri' => 'application/x-mswrite', 
);
5、php生成excel文档
header("콘텐츠 유형:application/vnd.ms-excel");
header("콘텐츠 처리:파일 이름=test.xls");
echo "test1t";
echo "test2tn";
echo "test1t";
echo "test2tn";
echo "test1t";
echo "test2tn";
echo "test1t";
echo "test2tn";
echo "test1t";
echo "test2tn";
echo "test1t";
echo "test2tn";
?> 방법 1:
//$db->rows[$i][date]는 데이터베이스의 날짜/시간 필드 값입니다.
$today=time()
$theDay=date ( "Y-m-d H:i:s",$today-24*3600)
$newTag=$db->rows[$i][date]>=$theDay?"":"";
방법 2:
$newTag=$db->rows[$i][date]>=date("Y-m-d 00: 00:00")?"