学习ThinkPHP3.2.2:了解并测试与3.1不同之处_自定义函数文件名称

原来的自定义函数文件名:Common\common.php

现在:D:\wamp\www\MyWeb\Application\Common\Common\function.php

测试自定义函数,以数组方式输出服务器信息:

function.php内容:






<?php
 
     function  p( $array ){
     dump( $array , 1,  '<pre>' , 0);
}

IndexController.class.php内容












<?php
namespace  Home\Controller;
use  Think\Controller;
 
 
class  IndexController  extends  Controller {
 
     public  function  index(){
         p( $_SERVER );
     }
}

浏览:http://localhost/myweb/

输出:










































Array
(
     [HTTP_HOST] => localhost
     [HTTP_CONNECTION] => keep-alive
     [HTTP_CACHE_CONTROL] => max-age=0
     [HTTP_USER_AGENT] => Mozilla/5.0 (Windows NT 6.0; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.89 Safari/537.1
     [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
     [HTTP_ACCEPT_ENCODING] => gzip,deflate,sdch
     [HTTP_ACCEPT_LANGUAGE] => zh-CN,zh;q=0.8
     [HTTP_ACCEPT_CHARSET] => GBK,utf-8;q=0.7,*;q=0.3
     [HTTP_COOKIE] => PHPSESSID=nubusc6dl1j07agjmqhq16kic3; onethink_admin___forward__=%2Fone%2Findex.php%3Fs%3D%2Fadmin%2Farticle%2Fmydocument.html
     [PATH] => C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;
     [SystemRoot] => C:\Windows
     [COMSPEC] => C:\Windows\system32\cmd.exe
     [PATHEXT] => .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
     [WINDIR] => C:\Windows
     [SERVER_SIGNATURE] => < address >Apache/2.4.9 (Win64) PHP/5.5.12 Server at localhost Port 80</ address >
 
     [SERVER_SOFTWARE] => Apache/2.4.9 (Win64) PHP/5.5.12
     [SERVER_NAME] => localhost
     [SERVER_ADDR] => ::1
     [SERVER_PORT] => 80
     [REMOTE_ADDR] => ::1
     [DOCUMENT_ROOT] => D:/wamp/www/
     [REQUEST_SCHEME] => http
     [CONTEXT_PREFIX] =>
     [CONTEXT_DOCUMENT_ROOT] => D:/wamp/www/
     [SERVER_ADMIN] => [email protected]
     [SCRIPT_FILENAME] => D:/wamp/www/MyWeb/index.php
     [REMOTE_PORT] => 50879
     [GATEWAY_INTERFACE] => CGI/1.1
     [SERVER_PROTOCOL] => HTTP/1.1
     [REQUEST_METHOD] => GET
     [QUERY_STRING] =>
     [REQUEST_URI] => /myweb/
     [SCRIPT_NAME] => /myweb/index.php
     [PHP_SELF] => /myweb/index.php
     [REQUEST_TIME_FLOAT] => 1406426644.747
     [REQUEST_TIME] => 1406426644
     [PATH_INFO] =>
)

你可能感兴趣的:(ThinkPHP3.2.2)