301Öض¨ÏòÉèÖü°³ÌÐò´úÂëʵÏÖÈ«¼¯(ASP|.NET|PHP|JSP)
Ê×ÏÈÉêÃ÷£ºÕâ¸öÊÇÎÒתÔصģ¬ÖÂÁ¦ÓÚΪÏñÎÒÒ»ÑùµÄÐÂÊÖÌṩ°ïÖú£¡
1¡¢IISÏÂ301ÉèÖà InternetÐÅÏ¢·þÎñ¹ÜÀíÆ÷ -> ÐéÄâĿ¼ -> Öض¨Ïòµ½URL£¬ÊäÈëÐèҪתÏòµÄÄ¿±êURL£¬²¢Ñ¡Ôñ“×ÊÔ´µÄÓÀ¾ÃÖض¨Ïò”¡£
2¡¢ASPϵÄ301תÏò´úÂë
<%@ Language=VBScript %>
<%
Response.Status=”301 Moved Permanently”
Response.AddHeader “Location”, “http://www.xuehi.com/articles/301/”
%>
3¡¢ASP.NetϵÄ301תÏò´úÂë
<script runat=”server”>
private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = “301 Moved Permanently”;
Response.AddHeader(”Location”,”http://www.xuehi.com/articles/301/“);
}
</script>
4¡¢PHPϵÄ301תÏò´úÂë
header(”HTTP/1.1 301 Moved Permanently”);
header(”Location: http://www.xuehi.com/articles/301/”);
exit();
5¡¢CGI PerlϵÄ301תÏò´úÂë
$q = new CGI;
print $q->redirect(”http://www.new-url.com/”);
6¡¢JSPϵÄ301תÏò´úÂë
<%
response.setStatus(301);
response.setHeader( “Location”, “http://www.xuehi.com/” );
response.setHeader( “Connection”, “close” );
%>
7¡¢ApacheÏÂ301תÏò´úÂëн¨.htaccessÎļþ£¬ÊäÈëÏÂÁÐÄÚÈÝ£¨ÐèÒª¿ªÆômod_rewrite£©£º
1£©½«²»´øWWWµÄÓòÃûתÏòµ½´øWWWµÄÓòÃûÏÂOptions +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^lesishu.cn [NC]
RewriteRule ^(.*)$ http://www.xuehi.com/$1 [L,R=301]
2£©Öض¨Ïòµ½ÐÂÓòÃûOptions +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*)$ http://www.xuehi.com/$1 [L,R=301]
3£©Ê¹ÓÃÕýÔò½øÐÐ301תÏò£¬ÊµÏÖα¾²Ì¬Options +FollowSymLinks
RewriteEngine on
RewriteRule ^news-(.+)\.html$ news.php?id=$1½«news.php?id=123ÕâÑùµÄµØַתÏòµ½news-123.html
8¡¢ApacheÏÂvhosts.confÖÐÅäÖÃ301תÏòΪʵÏÖURL¹æ·¶»¯£¬SEOͨ³£½«²»´øWWWµÄÓòÃûתÏòµ½´øWWWÓòÃû£¬vhosts.confÖÐÅäÖÃΪ£º<VirtualHost *:80>
ServerName www.xuehi.com
DocumentRoot /home/lesishu
</VirtualHost><VirtualHost *:80>
ServerName lesishu.cn
Redirec
Ïà¹ØÎĵµ£º
¡¡sessionÊÇÍøÕ¾±£´æÓû§ÐÅÏ¢µÄÒ»ÖÖÊֶΣ¬Ó¦ÓÃÏ൱¹ã·º¡£ÀýÈçµÚÎå½ìÅÅÐаñ¾ÍʹÓÃÁËsession¡£¾¹ý¶ÔµÚÎå½ìÅÅÐаñµÄÐ޸ģ¬ÎÒ×ܽáÁËÒ»ÏÂphpÖÐsessionµÄÓ÷¨¡£
£¨Ò»£©¿ªÊ¼session
¡¡¡¡ÔÚÿһ´ÎʹÓÃsession֮ǰ£¬¶¼Òª¼ÓÉÏÕâÒ»¾ä£º“session_start();”¡£¹ËÃû˼Ò壬Õâ¸öº¯ÊýµÄ×÷ÓþÍÊÇ¿ªÊ¼Ê¹ÓÃsession¡£
£¨¶þ£©×¢ ......
ÎÄ/Fenying
¡¡¡¡ÀýÈçÓг£ÓÃʱ¼ä¸ñʽ yyyy-mm-dd HH:ii:ss£¬ÈçºÎת»»³ÉPHPÖÐdateº¯Êý¿ÉʹÓõÄʱ¼ä¸ñʽÄØ£¿
¡¡¡¡Ê¹Óà PHPTimeFormatfromCommon() ¿ÉÒÔ°ÑͨÓÃʱ¼ä¸ñʽת»»³ÉPHPʱ¼ä¸ñʽ
¡¡¡¡¡¡¡¡PHPTimeFormatfromCommon('yyyy-mm-dd HH:ii:ss') => 'Y-m-d H:i:s'
¡¡¡¡Ê¹Óà PHPTimeFormatToCommon() ¿ÉÒÔ° ......
ʹÓ÷½·¨:
×Ô¶¯²ÃÇÐ:
³ÌÐò»á°´ÕÕͼƬµÄ³ß´ç´ÓÖв¿²ÃÇÐ×î´óµÄÕý·½ÐΣ¬²¢°´Ä¿±ê³ß´ç½øÐÐËõÂÔ
$t->setSrcImg("img/test.jpg");
$t->setCutType(1);//ÕâÒ»¾ä¾ÍOKÁË
$t->setDstImg("tmp/new_test.jpg");
$t-&g ......