易截截图软件、单文件、免安装、纯绿色、仅160KB

PHP+Ajax实现Tab效果

用Ajax实现Tab效果的
先创建
ajax.php,在其中输入如下代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Sample 2_1</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript">
<!--
//Create a boolean variable to check for a valid Internet Explorer instance.
var xmlhttp = false;
//Check if we are using IE.
function creatXMLHttp(){
 try
 {
  //If the Javascript version is greater than 5.
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  //alert ("You are using Microsoft Internet Explorer.");
 }
 catch (e)
 {
  //If not, then use the older active x object.
  try
  {
   //If we are using Internet Explorer.
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
   //alert ("You are using Microsoft Internet Explorer");
  }
  catch (E)
  {
   //Else we must be using a non-IE browser.
   xmlhttp = false;
  }
 }
 //If we are using a non-IE browser, create a javascript instance of the object.
 if (!xmlhttp && typeof XMLHttpRequest != 'undefined')
 {
  xmlhttp = new XMLHttpRequest();
  //alert ("You are not using Microsoft Internet Explorer");
 }
}
function makerequest(serverPage, objID)
{
 creatXMLHttp();
 var obj = document.getElementById(objID);
 xmlhttp.open("GET", serverPage);
 xmlhttp.onreadystatechange = function()
 {
  if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
  {
   obj.innerHTML = xmlhttp.responseText;
  }
 } 
 xmlhttp.send(null);


相关文档:

优化PHP代码的42条建议

1.如果一个方法可静态化,就对它做静态声明。速率可提升至4倍。
2.echo 比 print 快。
3.使用echo的多重参数(译注:指用逗号而不是句点)代替字符串连接。
4.在执行for循环之前确定最大循环数,不要每循环一次都计算最大值。
5.注销那些不用的变量尤其是大数组,以便释放内存。
6.尽量避免使用__get,__set,__a ......

PHP分割textarea转回的数据

假如一个textarea中有N多行的数据,要将它转为PHP的一维数组,
 <form id="textarea_test" action="textarea.php" method="post">
<textarea cols="50" rows="5" name="aa" id="abc" >

<?php
$str = $_POST['aa'];
//var_dump($str);
//$str = "chenjinle le";
$array = explode("\n", trim($ ......

PHP调用系统命令修改IP,netmask,gateway,mac,dns

ip_contrl.php:
<?php
 //include('header.php');
 
 $ipaddr = $_POST['ipaddr'];
 $netmask = $_POST['netmask'];
 $gateway = $_POST['gateway'];
 $mac = $_POST['mac'];
 $dns1 = $_POST['dns1'];
 $dns2 = $_POST['dns2'];
 //echo "ipaddr=$ipaddr;netm ......

Nginx+PHP+MySQL双机互备、全自动切换方案

在生产应用中,某台“Nginx+PHP+MySQL”接口数据服务器,扮演的角色十分重要,如果服务器硬件或Nginx、MySQL发生故障,而 短时间内无法恢复,后果将非常严重。为了避免单点故障,我设计了此套方案,编写了failover.sh脚本,实现了双机互备、全自动切换,故障转移时间 只需几十秒。
一、双机互备、全自动切换方案 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号