$path_parts = pathinfo("/www/htdocs/index.html");
echo $path_parts["dirname"] . "\n";目录名
echo $path_parts["basename"] . "\n";文件名
echo $path_parts["extension"] . "\n";扩展名
echo $path_parts["dirname"] . "\n";目录名
echo $path_parts["basename"] . "\n";文件名
echo $path_parts["extension"] . "\n";扩展名
解决方案 »
- 请教关于计划任务执行bat文件的问题,主要用于定时更新服务器的数据库
- 新手求教:thinkphp应该怎么学?
- 如何把下面的JS转换成PHP变量值?
- discuz下装supesite出错了?急救
- 有精通SEO技术的吗?我有个站有点问题,能帮忙诊断下吗?
- .htaccess这样写了还是不能重写url是什么原因
- php template模版 数组使用问题
- 想实现一个从顾客点菜到厨师煮菜的过程的程序,为什么这个程序的file_exists()会一直找不到文件?
- 我在应用phpMyAdmin下遇到的错误,请用过的帮我解决一下,谢谢
- 在php中怎样实现数字签名,或手工签名
- 紧急:apache+php+oracle升级连不上来
- script中怎么做才能调用 php中的变量,如下所示:
echo $path_parts["dirname"] . "\n";目录名
echo $path_parts["basename"] . "\n";文件名
echo $path_parts["extension"] . "\n";扩展名
function get_content_type($url)
{
$url = str_replace(" ", "%20", $url);
$TheURL_header = substr($url, 0, 7);
if($TheURL_header == "http://")
{
$pos = strpos($url, "/", 7);
if($pos)
{
$host = substr($url, 7, $pos - 7);
}
else
{
$host = substr($url, 7);
}
$referer = "http://".$host."/";
}
else
{
//---- 不是http连接 ----
return false;
}
$TheURL_footer = substr($url, strlen("http://".$host."/"));
$http_header = "";
$http_header .= "HEAD /".$TheURL_footer." HTTP/1.1\r\n";
$http_header .= "Host: ".$host."\r\n";
$http_header .= "Connection: close\r\n";
$http_header .= "Cache-Control: no-cache\r\n";
$http_header .= "\r\n";
$data = "";
$bytes = 0;
$fp = @fsockopen($host, 80, $errno, $errstr, 30);
if (!$fp)
{
//---- 连不上 ----
return false;
}
fwrite($fp, $http_header);
$CRLF = "\x0d"."\x0a"."\x0d"."\x0a";
while(!feof($fp))
{
//---- 读文件字节流 ----
$tmp_stream = fgets($fp, 1280);
$stream_header = substr($tmp_stream, 0, 9);
$stream_header = strtolower($stream_header);
if($stream_header == "location:")
{
//---- 转走了 ----
$remote_url = substr($tmp_stream, 9);
$remote_url = trim($remote_url);
$the_url_header = substr($remote_url, 0, 7);
if($the_url_header != "http://")
{
if(substr($remote_url, 0, 1) == "/")
{
$remote_url = substr($remote_url, 1);
$remote_url = "http://".$host.$remote_url;
}
else
{
$pos_url = strrpos($url, "/");
$remote_url = substr($url, 0, $pos_url)."/".$remote_url;
}
}
fclose($fp);
return get_redirect_url($url);
}
$stream_header = substr($tmp_stream, 0, 13);
$stream_header = strtolower($stream_header);
if($stream_header == "content-type:")
{
$type = substr($tmp_stream, 13);
$type = trim($type);
return $type;
}
if($tmp_stream == "\r\n")
{
//---- 头部信息结束 ----
break;
}
}
return false;
}
echo get_content_type("http://zi.csdn.net/zhangxx.gif");