Home php教程 PHP源码 php常用获取 apache 服务器信息函数

php常用获取 apache 服务器信息函数

May 26, 2016 am 08:19 AM

php代码

php常用获取 APACHE信息函数
 
*/
 
$version=apache_get_version(); //获得APACHE的版本并赋值给变量
 
echo "$version"; //输出结果
 
$server_ip=apache_getenv("server_addr"); //通过获取环境变量函数获取服务器的ip信息
 
echo $server_ip; //输出结果
 
$url_info=apache_lookup_uri('2-1.php教程'); //对url执行请求并返回信息
 
print_r($rul_info); //输出结果内容
 
if(file_exists($rul_info->filename)) //如果返回结果有值
 
{
 
echo 'file exists!'; //输出相应内容
 
}
 
 
 
apache_note("name","天夺之魄"); //设置apache的请求记录中的name值
 
 
 
echo apache_note("name"); //获取apache的请求记录中的name值
 
$headers=apache_request_headers(); //获得http请求标头
 
foreach($headers as $header=>$value) //通过循环输出结果数组
 
{
 
echo "$header:$value
 
n"; //输出数组键/值对
 
}
 
$result=apache_get_modules(); //返回apache加载的模块列表,并赋值给变量
 
 
 
print_r($result); //输出结果数组
 
 
 
if(apache_setenv("example_var","test_value")) //设置环境变量
 
{
 
echo "对apache环境变量example_var设置成功!"; //如果成功设置输出内容
 
}
 
else
 
{
 
echo "对apache环境变量example_var设置失败!"; //如果设置失败输出内容
 
}
Copy after login

     文章由PHP中文网提供,希望本文所述对大家的 APACHE 学习有所帮助,也希望大家继续关注PHP中文网!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)