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);
相关文档:
例子. return() 函数的用法
<?php
function square ($num)
{
return $num * $num;
}
echo square (4); // outputs '16'.
?>
函数不能返回多个值,但为了获得简单的结果,可以返回一个列表。
例子. 返回一个数组以得到多个返回值
<?php
function small_numbe ......
方法一:
<?php
function extend_1($file_name)
{
$retval="";
$pt=strrpos($file_name, ".");
if ($pt) $retval=substr($file_name, $pt+1, strlen($file_name) - $pt);
return ($retval);
}
?>
方法二:
function extend_2($file_name)
{
$extend = pathinfo($file_name);
$extend = strto ......
原文地址: http://blog.csdn.net/lmss82/archive/2010/05/10/5574772.aspx
这是一个完整可用的代码,部分代码来自于网络。
PHP:
5.26
JS环境:
jquery.js,jquery_form.js
使用步骤:
开启APC.
下载php_apc.dll,修改php.ini文件增加以下内容:
extension=php_apc.dll
apc.rfc1867 = On
代码:
<?php
//< ......
[root@BIND9-master /usr/local/bin]# php --ini
Configuration File (php.ini) Path: /usr/local/etc
Loaded Configuration File: /usr/local/Zend/etc/php.ini
Scan for additional .ini files in: /usr/local/etc/php
Additional .ini files parsed: &n ......