您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

php常见问题和解决方法三接上

2024/4/6 1:14:10发布17次查看
22:如何取得用户的真实ip
php代码:--------------------------------------------------------------------------------
function iptype1 () { 
if (getenv(http_client_ip)) { 
   return getenv(http_client_ip); 

else { 
   return none; 


function iptype2 () { 
if (getenv(http_x_forwarded_for)) { 
   return getenv(http_x_forwarded_for); 

else { 
   return none; 


function iptype3 () { 
if (getenv(remote_addr)) { 
   return getenv(remote_addr); 

else { 
   return none; 


function ip() { 
$ip1 = iptype1(); 
  $ip2 = iptype2(); 
$ip3 = iptype3(); 
if (isset($ip1) && $ip1 != none && $ip1 != unknown) { 
   return $ip1; 

elseif (isset($ip2) && $ip2 != none && $ip2 != unknown) { 
   return $ip2; 

elseif (isset($ip3) && $ip3 != none && $ip3 != unknown) { 
   return $ip3; 
}   
  else { 
  return none; 

}
echo ip(); 
?> 
--------------------------------------------------------------------------------
23:如何从数据库读取三天内的所有记录
首先表格里要有一个datetime字段记录时间,
格式为'2003-7-15 16:50:00'
select * from `xltxlm` where to_days(now()) - to_days(`date`)
24:如何远程链接mysql数据库
在增加用户的mysql表里有一个host字段,修改为%,或者指定允许连接的ip地址,这样,你就可以远程调用了。
$link=mysql_connect(192.168.1.80:3306,root,);
25:正则到底怎么用
点击这里
正则表达式中的特殊字符
26:用apache后,主页出现乱码
方法一: 
adddefaultcharset iso-8859-1 改为 adddefaultcharset off
方法二: 
adddefaultcharset gb2312
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product