In the directory where you plan to install Elgg, do the following:
Create the file .htaccess and add these two lines
RewriteEngine on
RewriteRule ^testing.php$ modrewrite.php
This tells the webserver to load modrewrite.php when testing.php is
requested.
In order to get this test to work on some virtual servers, you
may need to add:
RewriteBase /
prior to the RewriteRule line.
Create the file modrewrite.php with this line
<?php echo "mod_rewrite works"; ?>
Create the file testing.php with this line
<?php echo "mod_rewrite does not work"; ?>
Now use your web browser to load testing.php. The text that shows will
tell you whether mod_rewrite is working ......
在实际的程序开发中,执行字符串替换操作是一件非常经常的事,对
str_replace
函数的实用也会非常频繁。
这段时间在看《
PHP
和
MySQL Web
开发》一书看到
str_replace
讲解,一段小提示写到:可以为
str_replace
的三个都使用数组传入,但讲解比较简单,于是决定自己的试验一下该函数在各个参数传入数组时的执行结果。
函数原型:
mixed str_replace(mixed needle,mixed new_needle,mixed haystack[,int
&count]);
needle
:要被替换的字符串,
new_needle
:替换用的字符串,
haystack
:操作字符串,
count
:替换次数【可选参数】
我们重点试验前三个在使用数组是的执行方式:
在都不使用数组时,该函数直接使用
new_needle
替换所有的
needle
并返回替换后的字符串。如:
str_replace("m","n","my
name is jim!")
返回
ny nane is jin!
1
、只对
needle
使用数组。
&n ......
Output Control
函数可以让你自由控制脚本中数据的输出。它非常地有用,特别是对于:当你想在数据已经输出后,再输出文件头的情况。输出控制函数不对使用
header()
或
setcookie(),
发送的文件头信息产生影响
,
只对那些类似于
echo()
和
PHP
代码的数据块有作用。
我们先举一个简单的例子,让大家对
Output Control
有一个大致的印象:
Example 1.
CODE<?php
ob_start(); //
打开缓冲区
echo \"Hellon\"; //
输出
header("location:index.php"); //
把浏览器重定向到
index.php
ob_end_flush();//
输出全部内容到浏览器
?>
所
有对
header()
函数有了解的人都知道,这个函数会发送一段文件头给浏览器,但是如果在使用这个函数之前已经有了任何输出(包括空输出,比如空格,回
车和换行)就会提示出错。如果我们去掉第一行的
ob_start()
,再执行此程序,我们会发现得到了一条错误提示:
"Header
had all ready send by"
!但是加上
ob_start
,就不会提示出错,原因是当打开了缓冲区,
echo
后面的字符不会输出到浏览器,而是保留在服务器,直到你使用
flush
或者
ob_end_flush ......
xml_parse解析xml文件时候,
很有可能不仅仅调用一次character_handler。
所以在获得xml节点的文本信息的时候,要用连接运算".="。
参考 http://jp2.php.net/manual/ro/function.xml-set-character-data-handler.php
ken at positive-edge dot com
30-Jan-2002
01:20
the function handler is called several times when it parses the
character data. It doesn't return the entire string as it suggests.
There are special exceptions that will always force the parser to stop
scanning and call the character data handler. This is when:
- The parser runs into an Entity Declaration, such as & (&)
or ' (�)
- The parser finishes parsing an entity
- The parser runs into the new-line character (\n)
- The parser runs into a series of tab characters (\t)
And perhaps others.
For instance, if we have this xml content:
<mytag name=�Ken Egervari� title=�Chief Technology Officer�>
Ken has been ......
xml_parse解析xml文件时候,
很有可能不仅仅调用一次character_handler。
所以在获得xml节点的文本信息的时候,要用连接运算".="。
参考 http://jp2.php.net/manual/ro/function.xml-set-character-data-handler.php
ken at positive-edge dot com
30-Jan-2002
01:20
the function handler is called several times when it parses the
character data. It doesn't return the entire string as it suggests.
There are special exceptions that will always force the parser to stop
scanning and call the character data handler. This is when:
- The parser runs into an Entity Declaration, such as & (&)
or ' (�)
- The parser finishes parsing an entity
- The parser runs into the new-line character (\n)
- The parser runs into a series of tab characters (\t)
And perhaps others.
For instance, if we have this xml content:
<mytag name=�Ken Egervari� title=�Chief Technology Officer�>
Ken has been ......
<!--
/* Font Definitions */
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family:"\@宋体";
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-parent:"";
margin:0cm;
margin-bottom:.0001pt;
text-align:justify;
text-justify:inter-ideograph;
mso-pagination:none;
font-size:10.5pt;
mso-bidi-font-size:12.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:宋体;
mso-font-kerning:1.0pt;}
h1
{mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
mso-pagination:widow-orphan;
mso-outline-level:1;
font-s ......
导读:
Apache:
开启 httpd.conf,加入以下两行:
QUOTE:
ServerTokens ProductOnly
ServerSignature Off
PHP:
隐藏 PHP 版本就是隐藏 "X-Powered-By: PHP/5.1.2-1+b1" 这个,开启 php.ini,加入:
QUOTE:
expose_php = Off
Apache 禁止目录浏览:
禁止目录浏览
打开文件:httpd.conf
查找并定位到下面这行:
QUOTE:
Options Indexes FollowSymLinks
去掉这一行的 Indexes 即可,
完成以上两个设定后,重新启动 Apache 即可。 ......