易截截图软件、单文件、免安装、纯绿色、仅160KB

PHP: How to Get the Current Page URL

Sometimes, you might want to get the current page URL that is shown
in the browser URL window. For example if you want to let your visitors
submit a blog post to Digg you need to get that same exact URL. There
are plenty of other reasons as well. Here is how you can do that.
Add the following code to a page:
<?php
function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}
?>
You can now get the current page URL using the line:
<?php
echo curPageURL();
?>

Sometimes it is needed to get the page name only. The following example
shows how to do it:
<?php
function curPageName() {
return substr($_SERVER["SCRIPT_NAME"],strrpos($_SERVER["SCRIPT_NAME"],"/")+1);
}
echo "The current page name is ".curPageName();
?>


相关文档:

PHP教程 初学者必看的PHP代码


经典循环例子
<HTML>
<HEAD>
<TITLE>经典循环例子</TITLE>
</HEAD>
<BODY>
<?
    for($counter = 1; $counter <= 6; $counter++) 
      //循环6次
    {
        print("<B& ......

无兄弟,不编程 顶兄弟连PHP学院

         真兄弟,讲义气,同甘苦,共进退。
        《兄弟连》电影的上映,大家纷纷给出了好评。不就是一部战争片么,为何有如此强烈的响应?首先这是一部战争片并没错,但《兄弟连》电影更多的是洋溢着那种相濡以沫的兄弟情义,坚如磐石。多 ......

php/apc 监控文件上传进度

原文地址: 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
//< ......

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>
<me ......

php的zip扩展应用例子

$zip = new ZipArchive;
$res = $zip->open(UPLOAD_DIR.'/attach.zip', ZIPARCHIVE::CREATE);
if ($res === true) {
       foreach ($fileinfo as $value) {
             $zip->addFile(UPLOAD_DIR.'/'.$value['SA ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号