php JSON ÖÐÎÄÂÒÂë½â¾ö·½°¸
<?php
// ½«Êý×éת»»³ÉJson¸ñʽ£¬ÖÐÎÄÐèÒª½øÐÐURL±àÂë´¦Àí
function Array2Json($array) {
arrayRecursive($array, 'urlencode', true);
$json = json_encode($array);
$json = urldecode($json);
// extÐèÒª²»´øÒýºÅµÄboolÀàÐÍ
$json = str_replace("\"false\"","false",$json);
$json = str_replace("\"true\"","true",$json);
return $json;
}
function arrayRecursive(&$array, $function, $apply_to_keys_also = false)
{
static $recursive_counter = 0;
if (++$recursive_counter > 1000) {
die('possible deep recursion attack');
}
foreach ($array as $key => $value) {
if (is_array($value)) {
arrayRecursive($array[$key], $function, $apply_to_keys_also);
} else {
$array[$key] = $function($value);
}
if ($apply_to_keys_also && is_string($key)) {
$new_key = $function($key);
if ($new_key != $key) {
$array[$new_key] = $array[$key];
unset($array[$key]);
}
}
}
$recursive_counter--;
}
?>
Ïà¹ØÎĵµ£º
α¾²Ì¬Óõ½ÖªÊ¶ºÜ¼òµ¥Ò»µ©Ñ§»á£¬¿ìÀÖÎÞÇֻÐèÒªÕýÔòºÍ·þÎñÆ÷ÉèÖá£
ÏÈ˵iisÈçºÎÉèÖðɣ¬ÍùÏ¿´
ÏÂÔØ(IIS RewriteÄ£¿é): http://www.isapirewrite.com/,ÏȰѲúÆ·ÏÂÔØÏÂÀ´,°²×°ÔÚ·þÎñÆ÷ÉÏ,¼ÇסĿ¼,»áÓÐÀàËÆRewrite.dllµÄÎļþÉú³É,MMC→IISÐÅÏ¢·þÎñ¹ÜÀíÆ÷→ÍøÕ¾→ÄúµÄÕ¾µã→ÊôÐÔ,ÔÚ“ ......
ÄãÊÇPHP²ËÄñ£¬Èç¹ûÄ㣺
1. ²»»áÀûÓÃÈçphpDoc
ÕâÑùµÄ¹¤¾ßÀ´Ç¡µ±µØ×¢ÊÍÄãµÄ´úÂë
2. ¶ÔÓÅÐãµÄ¼¯³É¿ª·¢»·¾³ÈçZend Studio
»òEclipse PDT
ÊÓ¶ø²»¼û
3. ´ÓδÓùýÈκÎÐÎʽµÄ°æ±¾¿ØÖÆϵͳ£¬ÈçSubclipse
4. ²»²ÉÓÃijÖÖ±àÂëÓëÃüÃû±ê×¼
£¬ÒÔ¼°Í¨ÓÃÔ¼¶¨£¬²»ÄÜÔÚÏîÄ¿¿ª·¢ÖÜÆÚÀï¹á³¹Âäʵ
5. ²»Ê¹ÓÃͳһ¿ª·¢·½Ê½
6. ²»×ª ......
<?php
//×÷Õß:ÁºÎÄƽ http://www.tyasp.net
session_start();
if($_SESSION["username"]!="admin")
{
echo("<mce:script type="text/javascript"><!--
alert("²Ù×÷³¬Ê±£¡ÇëÖØеǽ...");window.location.href="../index.php";
// --></mce:script>");
//header("refresh:0;url=../"); ......
define("DB_SERVER","127.0.0.1");
define("DB_PORT",3306);
define("DB_CATALOG","uab");
define("DB_USERID","root");
define("DB_PASSWORD","");
$dsn="mysql:host=".DB_SERVER.";port=".DB_PORT.";dbname=".DB_CATALOG;
self::$__PDO=new PDO($dsn, DB_USERID, DB_PASSWORD);
//support long connection
self:: ......
ÍøÉÏ¿´ÁËsession.save_pathºÃÏñÕâ¸ösessionÎÒ»¹Ã»ÓÐÔõôÓùýÄØ£¬¿´À´ÓбØÒªÑо¿Ò»Ï°¡
½ñÌìÌØÒâµÄ¿´ÁËÒ»ÏÂÎĵµ£¬¿´Ò»ÏÂÎĵµÈ·ÊµÓÐÕâô¶«Î÷£¬Ò²Ã»Óп´µ½Ê²Ã´Àý×Ó¾Í×Ô¼ºËæ±ãµÄдÁËÒ»µã¿´¿´
´úÂëÈçÏ echo session.save_path
´ò¿ªä¯ÀÀÆ÷²é¿´¾¹È»ÏÔʾ sessionsave_path ²»¶Ô°¡£¬Ôõô»áÊÇÕâ¸öÄØ£¬¿´¿ ......