当前位置: 首页 > 编程日记 > 正文

Web服务器 之 Apache 2.x 服务器中的URL重写的配置和应用

作者:北南南北
来自:LinuxSir.Org
摘要: 本文是关于Apache 2.x 服务器中的URL别名规则的文档,它是通过rewrite模块来实现的。能过URL别名规则,我们能看到一个干净的URL,比如可以重写为类似静态网页的地址。比如 LinuxSir.Org 论坛中,每个帖子都有一个静态网页的地址。干净的URL,对于Google搜索引擎来说是极为受用的,能更快的收录。本文只是一个小提示,或者对有些弟兄有用。

目录 1、关于Apache 2.x URL别名的说明和设置;

1.1 关于rewrite模块的调用;
1.2 设置DocumentRoot的Directory;
1.3 重启httpd服务器;

2、关于Apache 2.x URL重写规则的应用;

2.1 vbb 论坛的URL地址重写配置
2.2 drupal 的URL地址重写设置;

3、关于本文;
4、修改日志;
5、参考文档;
6、相关文档;


++++++++++++++++++++++++++++++++++++
正文
++++++++++++++++++++++++++++++++++++


1、关于Apache 2.x URL别名的说明和设置;

Apache 2.x 服务器中的URL别名规则的文档,它是通过rewrite模块来实现的。能过URL别名规则,我们能看到一个干净的URL,比如可以重写为类似静态网页的地址。比如 LinuxSir.Org 论坛中,每个帖子都有一个静态网页的地址。干净的URL,对于Google搜索引擎来说是极为受用的,能更快的收录。

这个重写,是通过Apache 2.x 内部实现的,只是表面上把Web应用程序的URL变的干净一点,原始的URL还是一样有效。


1.1 关于rewrite模块的调用;


Apache 2.x 中URL重写,是通过mod_rewrite.so 来实现的,所以您要查看您的Apache 是否已经被编译进去这个模块了,并且在Apache的配置文件httpd.conf 中已经调用了这个模块。在大多数主流发行版中,Apache 2.x 是把rewrite模块已经编入进去了。比如我用的是Slackware。Apache 2.x的配置文件,放在 /etc/httpd 目录下。

在 httpd.conf 中,我们会发现类似如下的一行,是有关rewrite模块的,模块名是 mod_rewrite.so 。

LoadModule rewrite_module lib/httpd/modules/mod_rewrite.so

LoadModule rewrite_module lib/apache2/modules/mod_rewrite.so

如果前面有#号,您要去掉。对于大多数发行版来说,Apache 2的模块一般是位于如下的两个位置

/usr/lib/apache2/modules


/usr/lib/httpd/modules

如果在httpd中打开调用rewrite_module的设置,查看一下是不是能调用了,要通过 httpd -M的参数来查看;

#/usr/sbin/httpd -M

如果发现有如下一行,说明模块已经能被调用了

rewrite_module (shared)


1.2 设置DocumentRoot的Directory;

在Apache 2.x 中,我们会看到 DocumentRoot设置的一行。这行就是存放网页程序的地方。比如LinuxSir.Org 存放在 /opt/www 目录中。那么我们就要设置 DocumentRoot为如下的。

DocumentRoot "/opt/www"

然后我们再还要对 DocumentRoot做针对性的行为设置。在一般的情况下,httpd.conf 会给一个默认的。如果你要改 DocumentRoot的路径,同时也要改针对DocumentRoot的Directory的设置,也就是

<Directory "DocumentRoot所设置的路径">

比如我们把DocumentRoot的路径改为了 "/opt/www",那我们也要把 DocumentRoot做针对性的行为设置也要改成这个路径。

<Directory "/opt/www">

    Options FollowSymLinks
    #AllowOverride None 注:把这行前面加#号,然后加下面的一行  ,也就是   AllowOverride ALL
    AllowOverride ALL   
    Order allow,deny
    Allow from all

</Directory>

我们把AllowOverride 的参数设置为ALL,表示整台服务器上的,都支持URL规则重写。Apache 服务器要读每个网站下的家目录下的 .htaccess 文件。如果没有这个文件,或者这个文档没有定义任何关于URL重写的规则,则不会有任何效果。在一般的情况下,成熟的Web 服务器应用套件,都支持URL重写的,比如drupal和joomla 。当我们用这些程序时,会发现在安装包中有 .htaccess中有这个文件。我们把Apache配置好后,只是需要在这些程序的后台打开此功能就行了。


1.3 重启httpd服务器;


在一般情况下,在各个发行版中,都有httpd服务器启动脚本,比如


# /etc/rc.d/rc.httpd restart   注:Slackware Linux
# /etc/init.d/apache2 restart  注:ubuntu、Debian 等;
# /etc/init.d/httpd start  注:Fedora 、Redhat、CentOS



2、关于Apache 2.x URL重写规则的应用;

Apache 2.x 的rewrite模块调用和配置比较容易,这并不是目的。在应用为王的年代里,在服务器程序可选择的今天,应用才是王道。现在我就举例,说一下两个应用。一个vbb论坛的URL重写成类似的静态网页地址的,另一个就是drupal的URL地址重写。

关于vbb论坛程序的URL规则重写,我是从国外论坛看到的。可能有的朋友需要,对vbb 3.5或以上版本有效。我测试的是3.6版本,至于在其它版本上能否可行,这个由你来测试。我不敢保证。


2.1 vbb 论坛的URL地址重写配置




首先:在您的论坛程序存放的家目录下,创建一个.htaccess 文件;

内空如下:

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^getdaily.html$ search.php?do=getdaily [L]
RewriteRule ^getdaily([0-9]+).html$ search.php?do=getdaily&f=$1 [L]
RewriteRule ^unanswered.html$ search.php?do=process&replyless=1&replylimit=0&dontcache=1     [L]
RewriteRule ^unanswered([0-9]+).html$ search.php?do=process&replyless=1&replylimit=0&dontcache=1&forumchoice=$1&childforums=1 [L]
RewriteRule ^forum([0-9]+).html$        forumdisplay.php?f=$1         [L]
RewriteRule ^forum([0-9]+)-([0-9]+)-([a-z]+)-(.*)-([0-9]+)-(.*).html$ forumdisplay.php?f=$1&page=$2&sort=$3&order=$4&pp=$5&daysprune=$6 [L]
RewriteRule ^forum([0-9]+)-(.*)-([a-z]+)-([a-z]+).html$    forumdisplay.php?f=$1&daysprune=$2&order=$3&sort=$4     [L]
RewriteRule ^announcement([0-9]+).html$     announcement.php?f=$1     [L]
RewriteRule ^announcement([0-9]+)-([0-9]+).html$    announcement.php?f=$1&announcementid=$2 [L]
RewriteRule ^thread([0-9]+).html$     showthread.php?t=$1     [L]
RewriteRule ^thread([0-9]+)-([0-9]+).html$    showthread.php?t=$1&page=$2     [L]
RewriteRule ^getnew.html$ search.php?do=getnew [L]
RewriteRule ^getnew([0-9]+).html$ search.php?do=getnew&f=$1 [L]
RewriteRule ^printthread([0-9]+).html$    printthread.php?t=$1     [L]
RewriteRule ^sendthread([0-9]+).html$    sendmessage.php?do=sendtofriend&t=$1 [L]
RewriteRule ^referthread([0-9]+)-([0-9]+).html$ showthread.php?t=$1&referrerid=$2    [L]
RewriteRule ^lastpostinthread([0-9]+).html$ showthread.php?goto=lastpost&t=$1 [L]
RewriteRule ^newpostinthread([0-9]+).html$ showthread.php?goto=newpost&t=$1 [L]
RewriteRule ^nextnewesttothread([0-9]+).html$    showthread.php?t=$1&goto=nextnewest    [L]
RewriteRule ^nextoldesttothread([0-9]+).html$    showthread.php?t=$1&goto=nextoldest    [L]
RewriteRule ^post([0-9]+).html$     showthread.php?p=$1     [L]
RewriteRule ^post([0-9]+)-([0-9]+).html$    showpost.php?p=$1&postcount=$2    [L]
RewriteRule ^post([0-9]+)-([0-9]+)-([0-9]+).html$ showthread.php?p=$1&page=$2&pp=$3    [L]
RewriteRule ^thread([0-9]+)-([a-z]+).html$ showthread.php?mode=$2&t=$1    [L]
RewriteRule ^post([0-9]+)-([a-z]+).html$ showthread.php?p=$1&mode=$2    [L]




第二:创建一个xml文件;

比如您可以用 vbburlhack.xml ,在这个文件内贴上如下内容;

<?xml version="1.0" encoding="UTF-8"?>



<product productid="danis_seo_optimization" active="1">
<title>Danis Seo Optimization</title>
<description><![CDATA[This is a very quick 'n' simple vBulletin SEO hack. It's easy to apply and it's the one I have been using here on DaniWeb for the past couple of months. I was going to wait until we went vB 3.5 to release it but I might as well do so now ... Disclaim]]></description>
<version>1.0</version>
<codes>
</codes>
<templates>
</templates>
<plugins>
<plugin active="1">
<title><![CDATA[Dani's SEO optimization]]></title>
<hookname>global_complete</hookname>
<phpcode><![CDATA[// do Dani's SEO optimization

global $session;



$search_array = array(

'#<a ([^>]*)href' . preg_quote("=\"forumdisplay.php?$session[sessionurl]f=") . '([0-9]+)' . preg_quote("&amp;page=") . '([0-9]+)' . preg_quote("&amp;sort=") . '([a-z]*)' . preg_quote("&amp;order="). '([a-z]*)' . preg_quote("&amp;pp=") . '([0-9]*)' . preg_quote("&amp;daysprune="). '([^"]*)"#',

'#<a ([^>]*)href' . preg_quote("=\"forumdisplay.php?$session[sessionurl]f=") . '([0-9]+)' . preg_quote("&amp;daysprune=") . '([^"]*)' . preg_quote("&amp;order=") . '([a-z]*)' . preg_quote("&amp;sort=") . '([a-z]*)' . preg_quote("&amp;pp=") . '([0-9]*)' . preg_quote("&amp;page=") . '([0-9]+)"#',

'#<a ([^>]*)href' . preg_quote("=\"forumdisplay.php?$session[sessionurl]f=") . '([0-9]+)' . preg_quote("&amp;daysprune=") . '([^"^&]*)' . preg_quote("&amp;order=") . '([a-z]*)' . preg_quote("&amp;sort=") . '([a-z]*)"#',

'#<a ([^>]*)href' . preg_quote("=\"forumdisplay.php?$session[sessionurl]f=") . '([0-9]+)' . preg_quote("&amp;daysprune="). '([^"^&]*)"#',

'#<a ([^>]*)href' . preg_quote("=\"forumdisplay.php?$session[sessionurl]f=") . '([0-9]+)' . preg_quote("&amp;page=") . '([0-9]+)"#',

'#<a ([^>]*)href' . preg_quote("=\"forumdisplay.php?$session[sessionurl]f=") . '([0-9]+)"#',

'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]t=") . '([0-9]+)' . preg_quote("&amp;page=") . '([0-9]*)' . preg_quote("&amp;pp=") . '([0-9]+)"#',

'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]t=") . '([0-9]+)' . preg_quote("&amp;page=") . '([0-9]+)"#',

'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]t=") . '([0-9]+)"#',

'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]goto=lastpost&amp;t=") . '([0-9]+)"#',

'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]goto=newpost&amp;t=") . '([0-9]+)"#',

'#<a ([^>]*)href' . preg_quote("=\"printthread.php?$session[sessionurl]t=") . '([0-9]+)"#',

'#<a ([^>]*)href' . preg_quote("=\"sendmessage.php?$session[sessionurl]do=sendtofriend&amp;t=") . '([0-9]+)"#',

'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]t=") . '([0-9]+)' . preg_quote("&amp;goto=next"). '([a-z]+)"#',

'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]p=") . '([0-9]+)"#',

'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]p=") . '([0-9]+)' . preg_quote("&amp;page=") . '([0-9]+)' . preg_quote("&amp;pp=") . '([0-9]+)"#',

'#<a ([^>]*)href' . preg_quote("=\"showpost.php?$session[sessionurl]p=") . '([0-9]+)' . preg_quote("&amp;postcount=") . '([0-9]+)"#',

'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]mode=") . '([a-z]+)' . preg_quote("&amp;t=") . '([0-9]+)"#',

'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]p=") . '([0-9]+)' . preg_quote("&amp;mode=") . '([a-z]+)\##',



'#<a ([^>]*)href' . preg_quote("=\"announcement.php?$session[sessionurl]f=") . '([0-9]+)' . preg_quote("&amp;announcementid=") . '([0-9]+)"#',

'#<a ([^>]*)href' . preg_quote("=\"announcement.php?$session[sessionurl]f=") . '([0-9]+)"#',



// sanitizing

'#<a ([^>]*)href\=\"([^"]*)&amp;page=([^"]*).html"#',

'#<a ([^>]*)href\=\"([^"]*)&amp;highlight=([^"]*).html"#',



// other

'#<a ([^>]*)href' . preg_quote("=\"search.php?$session[sessionurl]do=getdaily&amp;f=") . '([0-9]*)"#',

'#<a ([^>]*)href' . preg_quote("=\"search.php?$session[sessionurl]do=getdaily") . '"#',

'#<a ([^>]*)href' . preg_quote("=\"search.php?$session[sessionurl]do=process&amp;replyless=1&amp;replylimit=0&amp;dontcache=1&amp;forumchoice=&amp;childforums=1") . '"#',

'#<a ([^>]*)href' . preg_quote("=\"search.php?$session[sessionurl]do=process&amp;replyless=1&amp;replylimit=0&amp;dontcache=1&amp;forumchoice=") . '([0-9]+)' . preg_quote("&amp;childforums=1") . '"#'



);

$replace_array = array(

'<a \1href="forum\2-\3-\4-\5-\6-\7.html"',

'<a \1href="forum\2-\7-\5-\4-\6-\3.html"',

'<a \1href="forum\2-\3-\4-\5.html"',

'<a \1href="forum\2-\3.html"',

'<a \1href="forum\2-\3.html"',

'<a \1href="forum\2.html"',

'<a \1href="thread\2-\3.html"',

'<a \1href="thread\2-\3.html"',

'<a \1href="thread\2.html"',

'<a \1href="lastpostinthread\2.html"',

'<a \1href="newpostinthread\2.html"',

'<a \1href="printthread\2.html"',

'<a \1href="sendthread\2.html"',

'<a \1href="next\3tothread\2.html"',

'<a \1href="post\2.html"',

'<a \1href="post\2-\3-\4.html"',

'<a \1href="post\2-\3.html"',

'<a \1href="thread\3-\2.html"',

'<a \1href="post\2-\3.html#',



'<a \1href="announcement\2-\3.html"',

'<a \1href="announcement\2.html"',



// sanitizing

'<a \1href="\2-\3.html"',

'<a \1href="\2-\3.html"',



// other

'<a \1href="getdaily\2.html"',

'<a \1href="getdaily.html"',

'<a \1href="unanswered.html"',

'<a \1href="unanswered\2.html"'



);

$output = preg_replace($search_array, $replace_array, $output);]]></phpcode>
</plugin>
</plugins>
<phrases>
</phrases>
<options>
</options>
</product>



第三:从vbb后台登录,点击产品,然后导入这个vbburlhack.xml 文件;

只要导入,就能成功了。效果可参见 http://www.linuxsir.org/bbs

注意:如果出现错误,就是你的.htaccess 没放对地方,或者权限不对。如果有问题,不要来问我,这个插件不是我写的,是洋人写的,我只是搬过来应用。呵。。。。出问题就去找他们吧。谢谢了~~~~


2.2 drupal 的URL地址重写设置;

drupal就比较简单了,不象vbb一样,要自己来弄,drupal程序本身就提供了.htaccess 文件。在安装程序的目录里就有。我们只是设置一下就能用了。要通过管理员帐号登录。如果您安装的了中文模块的支持,就是定义干净的URL,他要我们来测试是否能用。如果测试通过,打开就是了。只是点鼠标。如果你没有通过,说明你把.htaccess 文件给丢了,下载一份drupal,把这个文件复制过去就行了。注意是.htaccess ,前面有个小点……


3、关于本文;

本文是在维护 LinuxSir.Org 服务器的过程中,想到Clean URL是比较重要的, 因为这样Google就可以更加有效率的收录网页了。我们可以利用Google的搜索找到我们所需要的东西。在一定程度上,缓解了 LinuxSir.Org 服务器的压力。我们把搜索、邮局让Google来托管,可以减轻我们维护服务器的工作量,感谢Google!


4、修改日志;

2007/11/23 v0.1b 完成,进入修订阶段;


5、参考文档;

apache2 官方文档 httpd.apache.org
vbb 程序参考: 《The quick 'n' dirty ultra simple vBulletin SEO hack》
drupal 参考:drupal.org


6、相关文档;

《关于Apache (httpd)服务器防DDOS模块mod_evasive的使用说明》
《简易WWW服务器的架设》
《apache2 安装与配置》

相关文章:

杜拉拉的作者李可应北大就业指导中心之约写给大学生的一封信

本文是杜拉拉的作者李可应北大就业指导中心之约写给大学生的一封信。 北大的同学们&#xff0c;大家好&#xff1a;又到了临近毕业的日子&#xff0c;年复一年&#xff0c;在这个梦想周期性遭遇现实的季节&#xff0c;对一代又一代的莘莘学子而言&#xff0c;在精神上和身体上准…

VLC架构及流程分析

0x00 前置信息 VLC是一个非常庞大的工程&#xff0c;我从它的架构及流程入手进行分析&#xff0c;涉及到一些很细的概念先搁置一边&#xff0c;日后详细分析。 0x01 源码结构&#xff08;Android Java相关的暂未分析&#xff09; # build-android-arm-linux-androideabi/&#…

eclipse运行程序时只有run on server

最近写jsp的程序比较多&#xff0c;写java程序时&#xff0c;发现一点击运行按钮就开始启动服务器了&#xff0c; 这是因为没有写主函数的原因 注意这个问题

自动生成小学四则运算题目的程序.心得体会

http://t.cn/RAS67B0 源代码 #include<stdio.h> #include<stdlib.h>#include<time.h>main(){int a,b,op,os; printf(" [天天练&#xff0c;Baby们来挑战吧!]\n");aq1: printf("选择您想挑战的运算法则\n");printf("1.加法 2.减法 3…

试图运行项目时出错,无法启动调试。没有正确安装调试器,请运行安装程序安装或恢复调试器。...

用Visual Studio.net 2003调试项目时&#xff0c;出现错误对话框&#xff0c;显示如下&#xff1a;试图运行项目时出错&#xff0c;无法启动调试。没有正确安装调试器&#xff0c;请运行安装程序安装或恢复调试器。解决方法如下&#xff1a; 1、在命令行中尝试重新注册m…

Memcached, Redis, MongoDB区别

mongodb和memcached不是一个范畴内的东西。mongodb是文档型的非关系型数据库&#xff0c;其优势在于查询功能比较强大&#xff0c;能存储海量数据。mongodb和memcached不存在谁替换谁的问题。和memcached更为接近的是redis。它们都是内存型数据库&#xff0c;数据保存在内存中&…

idea使用maven创建java工程log4j的配置

错误&#xff1a;在pom.xml文件中 project下有下划线&#xff0c;报错 改正&#xff1a; <!-- 配置日志 --><dependency><groupId>log4j</groupId><artifactId>log4j</artifactId><version>1.2.12</version></dependency&g…

kaggle预测

两个预测kaggle比赛 一 .https://www.kaggle.com/c/web-traffic-time-series-forecasting/overview Arthur Suilin•(1st in this Competition)•a year ago•Options github&#xff1a;https://github.com/sjvasquez/web-traffic-forecasting My model is basically RNN seq2…

PHP开发中,让var_dump调试函数输出更美观 ^_^#

前提&#xff1a;php必须安装Xdebug模块。 用var_dump打印输出时&#xff0c;输出的内容没有被格式化。如下图&#xff1a; 通常使用var_dump打印的内容是被格式化后输出的&#xff0c;如下图&#xff1a; 造成没有格式化输出的原因是因为php.ini设置的问题&#xff0c;使用php…

@Override is not allowed when implementing interface method

用idea打开项目&#xff0c;有下划线 解决办法&#xff1a; 选中出现红色下划线的项目&#xff0c;右键单击&#xff0c;选择open module settings 将language level改为8-Lambdas… 点击apply 选择projects&#xff0c;进行更改 点击apply 点击ok 即可

C#发现之旅第一讲 C#-XML开发

C#发现之旅第一讲 C#&#xff0d;XML开发 袁永福 2008-5-15 系列课程说明 为了让大家更深入的了解和使用C#&#xff0c;我们将开始这一系列的主题为“C#发现之旅”的技术讲座。考虑到各位大多是进行WEB数据库开发的&#xff0c;而所谓发现就是发现我们所不熟悉的领域&#xff…

页面的前进/后退/刷新方法

前进一页 οnclick"javascript:window.history.forward()" 后退一页 οnclick"javascript:window.history.back();" 前进/后退 n页 n为正是前进,负数是后退 onclick"javascript:window.history.go(n);" 刷新 οnclick"window.location.re…

25. javacript高级程序设计-新兴的API

1. 新兴的API requestAnimationFrame()&#xff1a;是一个着眼于优化js动画的api&#xff0c;能够在动画运行期间发出信号。通过这种机制&#xff0c;浏览器就能够自动优化屏幕重绘操作 Page Visibility API&#xff1a;让开发人员知道用户什么时候正在看着页面&#xff0c;而什…

Git-remote Incorrect username or password ( access token )

码云上传错误 错误原因&#xff1a;输入git clone https://地址&#xff1b;回车之后弹框输入码云的用户名和密码&#xff0c;用户名我输入的是码云的昵称&#xff0c;应该输入注册时的电子邮箱地址&#xff0c;当我关闭命令框&#xff0c;重新输入输入git clone https://地址&…

jquery选择器的使用方式

1.基本选择器选择器描述返回示例代码说明1id选择器根据指定的id匹配元素单个元素$("#one").css("background","#bbffaa");找到id为one的元素&#xff0c;改变其background属性2class选择器根据给定的类名匹配元素集合元素$(".mini").c…

互动网计算机频道图书7日销售排行(05.20-05.26)

互动网计算机频道图书7日销售排行&#xff08;05.20-05.26&#xff09; 1、Hadoop权威指南&#xff08;中文版&#xff09; 2、人人都是产品经理 3、演讲之禅&#xff1a;一位技术演讲家的自白 内容简介 本书既实用又引人入胜。作为职业演讲家&#xff0c;作者斯科特博克顿为…

Xtreme.Toolkit.Pro编译简单教程

前面介绍了Codejock.Xtreme.Toolkit.Pro&#xff0c;下面介绍一下它的安装和编译。 1.先下载Codejock.Xtreme.Toolkit.Pro 2.安装&#xff1a;一路“下一步”&#xff0c;很简单 3.安装完以后会出一个新的“codejock deployment wizard”窗口&#xff0c;这里你可以跟据需要&am…

上传代码到码云(第一次)

下载git&#xff1b; 注册码云的账号&#xff1b; ssh创建&#xff08;参考百度&#xff0c;较简单&#xff09; 新建仓库&#xff1b; 在电脑上新建文件夹gitcode&#xff1b; 在gitcode文件夹下右键 git bash&#xff1b; 输入git clone https://地址&#xff1b;&#xff0…

《JavaScript编程实战》

《JavaScript编程实战》 基本信息 原书名&#xff1a;JavaScript programming: pushing the limits 作者&#xff1a; (美)Jon Raasch 译者&#xff1a; 吴海星 丛书名&#xff1a; 图灵程序设计丛书 出版社&#xff1a;人民邮电出版社 ISBN&#xff1a;9787115345486 上架时…

再识C中的结构体

在前面认识C中的结构体中我介绍了结构体的基础知识&#xff0c;下面通过这段代码来回顾一下&#xff1a; 1 #include<stdio.h>2 #define LEN 203 4 struct Student{ //定义结构体5 char name[LEN];6 char address[LEN];7 int age;8 };9 10 int m…

《妙解Hibernate 3.X》读书笔记一-Hibernate概述及环境搭建

很早就想开始Hibernate的系统学习&#xff0c;但是一是工作原因&#xff0c;二是苦于找不到合适的书籍。Hibernate更新较快&#xff0c;一些被称为经典的书籍&#xff0c;如<深入浅出Hibernate>、《Hibernate实战》等都过于年老&#xff0c;介绍的为Hibernate2.1&#xf…

ssm框架实现学生成绩管理系统

学习ssm框架&#xff0c;写的一个小项目&#xff0c;参考 实现的功能有&#xff1a;学生信息增删改查&#xff0c;成绩信息查询&#xff0c;修改&#xff0c;求平均值&#xff0c; 附上链接&#xff0c;欢迎下载 git clone https://gitee.com/LOL_toulan/SpringBootProject.gi…

如何查找特定目录下最大的文件及文件夹

如何查看特定目录下大小在前10位的文件 find 目录 -ls |sort -nrk7 |head 参数说明如下&#xff1a; -ls True; list current file in ls -dils format on standard output. 没加-ls之前&#xff0c;输出的只是文件名&#xff0c;类似于 /u01/app/oracle/oradata/test/…

LightOJ 1364 Expected Cards(概率+DP)

题目链接&#xff1a;http://lightoj.com/volume_showproblem.php?problem1364 题意&#xff1a;一副牌。依次在桌面上放牌。求放了四种花色的牌为C,D,H,S张时放的牌数的期望。大小王出现时必须将其指定为某种花色。指定时要使最后的期望最小。 思路&#xff1a;DP&#xff0c…

会计科目中英文对照表

现金 Cash in hand 银行存款 Cash in bank 其他货币资金-外埠存款Other monetary assets - cash in other cities 其他货币资金-银行本票 Other monetary assets - cashier‘s check 其他货币资金-银行汇票 Other monetary assets - bank draft 其他货币资金-信用卡 Other…

关于get和post两种提交方式

Get请求&#xff1a; 1.可携带的数据量小 2.只能存放字符串类型的数据&#xff0c;不能存放bean对象 3.安全性差&#xff0c;例如如果在登录上使用get请求&#xff0c;在地址栏中会显 示输入的username和password 4.客户端在接收到get请求后&#xff0c;浏览器会自动的缓存响应…

数据库原理与设计 P75作业 学号2013211466 班级0401302

习题5 2. (1)写出关系模式&#xff1a; 学生:R1 U1{学号,姓名,出生日期,系名,班号,宿舍区}; F1{学号->(姓名,出生日期,系名,班号,宿舍区)&#xff0c;班号->系名&#xff0c;系名->宿舍区}&#xff1b; 班级:R2 U2{班号,专业名,系名,人数,入校年份}; F2{班号->(专业…

Windows DDK介绍,选择和安装

windows的文档工作还是非常不错的&#xff0c;所有的信息都可以从windows DDK主页和DDK自带的帮助文档中获得&#xff0c;本文只是一个总结。 今天开始正式接触DDK&#xff0c;首先来到DDK主页&#xff0c;有如下信息有用&#xff1a; 1. 选择安装什么版本的DDK。目前DDK的推荐…

关于jsp基础知识题目(一)

1.为了标识一个HTML文件&#xff0c;应该使用标记 html 2.form表单中提交数据的目的地址的属性是 action 3.关于post&#xff1a;安全性较好&#xff0c;地址栏看不到提交的数据&#xff0c;超链接标识post提交方式&#xff0c;可以传输大量数据 4.表单的提交方式有 2 种 5…

GO环境变量设置

GOROOT就是go的安装路径在~/.bash_profile中添加下面语句: GOROOT/usr/local/go export GOROOT 当然, 要执行go命令和go工具, 就要配置go的可执行文件的路径:操作如下:在~/.bash_profile中配置如下:export $PATH:$GOROOT/bin如果是windows需要使用;符号分割两个路径, mac和类un…