PHP开发文件系统实例讲解

 更新时间:2016年11月25日 16:33  点击:2018
PHP中有许多与文件系统有关的函数,这些函数不仅可以打开文件,还可以显示目录中的内容、移动文件和其他一些功能,许多人甚至用PHP开发基于互联网的文件资源管理器。
下面的脚本样例可以显示一个目录清单,注释已经包含在代码中:
<? / 懂得HTML(超文本标识语言)的读者都应该知道在“<FORM>”的标签内可使用添加“GET”和“POST”参数的方式将资料送回HTTP服务器,其实,在PHP语言中我们同样可以使用“GET”及“POST”参数。除此之外,在网址上亦可以加上“GET”的资料,例如我们以下面的URL为例:
http://www.yourserver.com/download/down.php?id=1
http://www.yourserver.com/news/show.php?page=1
这些URL通常在网站的搜索引擎中会使用得最多,你看到的URL中都带了各种参数,目的是为了将资料传回http服务器以便找到相关信息。如果你觉得这个方式不好,笔者有另外一种方法可将传送的资料加在 URL 上,例如下面的网址:http://www.yourserver.com/vote/php/show.php/200107/2138/。
其对应的PHP源代码如下:
< JAVA是个非常强大的编程利器,它的扩展库也是非常的有用,这篇教程,主要讲述怎样使用PHP调用功能强大的JAVA 类库(classes)。为了方便你的学习,这篇教程将包括JAVA的安装及一些基本的例子。
windows下的安装
第一步:安装JDK,这是非常容易的,你只需一路回车的安装好。然后做好以下步骤。
在 Win9x 下加入 :“PATH=%PATH%;C:jdk1.2.2in” 到AUTOEXEC.BAT文件中
在 NT 下加入 “;C:jdk1.2.2in”到环境变量中。
这一步是非常重要的,这样PHP才能正确的找到需调用的JAVA类。
第二步:修改你的PHP.INI文件。
[java]
extension=php_java.dll
java.library.path=c:webphp4extensions
java.class.path="c:webphp4extensionsjdk1.2.2php_java.jar;c:myclasses"
在PHP.INI中加入extension=php_java.dll
并在[java]中,设定好java.class.path,让它指向php_java.jar,如果你使用新的JAVA类,你也应该存入这个路径,在这篇例子中,我们使用c:myclasses这个目录。
第三步:测试环境,创建如下PHP文件:

$system = new Java("java.lang.System");
print "Java version=".$system->getProperty("java.version")."
";
print "Java vendor=".$system->getProperty("java.vendor")."
";
print "OS=".$system->getProperty("os.name")." ".
$system->getProperty("os.version")." on ".
$system->getProperty("os.arch")."
";
$formatter = new Java("java.text.SimpleDateFormat","EEEE,
MMMM dd, yyyy 'at' h:mm:ss a zzzz");
print $formatter->format(new Java("java.util.Date"))." ";
?>
如果你正确安装了,你将会看到以下信息:
Java version=1.2.2
Java vendor=Sun Microsystems Inc.
OS=Windows 95 4.10 on x86
Wednesday, October 18, 2000 at 10:22:45 AM China Standard Time
这样,我们就已经成功的建立起了可以使用JAVA类的PHP运行环境,我们可以开始我们接下去的课程了。
作者:井中月
转载:
Compiling php with crypt()
author:
Daniel Beulshausen
updated:
14.10.2000


This quick tutorial shall help you to compile php with support for the crypt() function, because it's not correct that if you use windows you can't use crypt().
It is however correct that libcrypt isn't available by default on windows, but you can use the libary from our download section.
Extract the zip and move crypt.h to your include folder, and the needed libary (release or debug) to your libary folder (tools -> options -> folders).
Load the php workspace, and add crypt.c (can be found in ext/standard/) to the php4dllts group (you can put crypt.c to Function Modules -> Source Files).
Now edit the link options of the php4dllts project, and add libcrypt to the link libaries, note that we compiled a release and a debug libary, please use only release for the release builds, and the debug libary for debug builds!
Now edit config.w32.h (located in main/), edit it and change the needed defines:
#define HAVE_CRYPT 1
#define HAVE_CRYPT_H 1
This should do the trick, and it'll build you php with the crypt() function. 
read_exif_data
(PHP 4 )
read_exif_data -- Reads header information stored in TIFF and JPEG images
Description
array exif_read_data ( string filename, string sections, bool arrays, bool thumbnail)
Note: The read_exif_data() function is an alias for exif_read_data().
See also exif_thumbnail().
User Contributed Notes
read_exif_data
inq@inq.dhs.org
03-Jan-2001 03:52
Each of my jpeg files are over 1 meg, and read_exif_data seems to read the
whole file and it's very slow. So I wrote a function to read only the
beginning of each file:
function read_exif_data_quick($path) {
$tmpfile = "/tmp/read_exif_data_quick.tmp_file";
$in = fopen($path, "r");
$out = fopen($tmpfile,"w");
fwrite( $out, fread( $in, 15000 ) );
fclose($in);
fclose($out);
return read_exif_data($tmpfile);
}
And so far it works for all of my jpegs (taken with my digital camera).
garbage@sunflowerroad.com
06-Jul-2001 05:33
I started drooling when I saw that php could read the exif information
automatically for me. Then I found out that read_exif_data is NOT
compiled into the standard win32 build (think about including it please!).
To get around this I found the following program that runs from the
command line and works really well.
it's actually a set of utilities that will even allow you to put exif data
into images.
It's freeware, but the license says no commercial use without written
permission.
http://www.users.bigpond.com/hughthomas/exif.html
garbage@sunflowerroad.com
06-Jul-2001 05:34
By the way, it works under linux or win32
ibaldin@anr.mcnc.org
21-Aug-2001 11:43
Perl Image::Info module is capable of reading EXIF tags (places them into
an associative array). You can write a simple script to use the module and
it will extract all or only required tags out of a jpeg file.
[!--infotagslink--]

相关文章

  • php读取zip文件(删除文件,提取文件,增加文件)实例

    下面小编来给大家演示几个php操作zip文件的实例,我们可以读取zip包中指定文件与删除zip包中指定文件,下面来给大这介绍一下。 从zip压缩文件中提取文件 代...2016-11-25
  • Jupyter Notebook读取csv文件出现的问题及解决

    这篇文章主要介绍了JupyterNotebook读取csv文件出现的问题及解决,具有很好的参考价值,希望对大家有所帮助。如有错误或未考虑完全的地方,望不吝赐教...2023-01-06
  • Photoshop打开PSD文件空白怎么解决

    有时我们接受或下载到的PSD文件打开是空白的,那么我们要如何来解决这个 问题了,下面一聚教程小伙伴就为各位介绍Photoshop打开PSD文件空白解决办法。 1、如我们打开...2016-09-14
  • C#操作本地文件及保存文件到数据库的基本方法总结

    C#使用System.IO中的文件操作方法在Windows系统中处理本地文件相当顺手,这里我们还总结了在Oracle中保存文件的方法,嗯,接下来就来看看整理的C#操作本地文件及保存文件到数据库的基本方法总结...2020-06-25
  • 解决python 使用openpyxl读写大文件的坑

    这篇文章主要介绍了解决python 使用openpyxl读写大文件的坑,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧...2021-03-13
  • C#实现HTTP下载文件的方法

    这篇文章主要介绍了C#实现HTTP下载文件的方法,包括了HTTP通信的创建、本地文件的写入等,非常具有实用价值,需要的朋友可以参考下...2020-06-25
  • SpringBoot实现excel文件生成和下载

    这篇文章主要为大家详细介绍了SpringBoot实现excel文件生成和下载,文中示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下...2021-02-09
  • php无刷新利用iframe实现页面无刷新上传文件(1/2)

    利用form表单的target属性和iframe 一、上传文件的一个php教程方法。 该方法接受一个$file参数,该参数为从客户端获取的$_files变量,返回重新命名后的文件名,如果上传失...2016-11-25
  • php批量替换内容或指定目录下所有文件内容

    要替换字符串中的内容我们只要利用php相关函数,如strstr,str_replace,正则表达式了,那么我们要替换目录所有文件的内容就需要先遍历目录再打开文件再利用上面讲的函数替...2016-11-25
  • PHP文件上传一些小收获

    又码了一个周末的代码,这次在做一些关于文件上传的东西。(PHP UPLOAD)小有收获项目是一个BT种子列表,用户有权限上传自己的种子,然后配合BT TRACK服务器把种子的信息写出来...2016-11-25
  • BootStrap栅格系统、表单样式与按钮样式源码解析

    这篇文章主要为大家详细解析了BootStrap栅格系统、表单样式与按钮样式源码,具有一定的参考价值,感兴趣的小伙伴们可以参考一下...2017-01-23
  • AI源文件转photoshop图像变模糊问题解决教程

    今天小编在这里就来给photoshop的这一款软件的使用者们来说下AI源文件转photoshop图像变模糊问题的解决教程,各位想知道具体解决方法的使用者们,那么下面就快来跟着小编...2016-09-14
  • C++万能库头文件在vs中的安装步骤(图文)

    这篇文章主要介绍了C++万能库头文件在vs中的安装步骤(图文),文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧...2021-02-23
  • Zend studio文件注释模板设置方法

    步骤:Window -> PHP -> Editor -> Templates,这里可以设置(增、删、改、导入等)管理你的模板。新建文件注释、函数注释、代码块等模板的实例新建模板,分别输入Name、Description、Patterna)文件注释Name: 3cfileDescriptio...2013-10-04
  • C#路径,文件,目录及IO常见操作汇总

    这篇文章主要介绍了C#路径,文件,目录及IO常见操作,较为详细的分析并汇总了C#关于路径,文件,目录及IO常见操作,具有一定参考借鉴价值,需要的朋友可以参考下...2020-06-25
  • python实现学生通讯录管理系统

    这篇文章主要为大家详细介绍了python实现学生通讯录管理系统,文中示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下...2021-02-25
  • php文件上传你必须知道的几点

    本篇文章主要说明的是与php文件上传的相关配置的知识点。PHP文件上传功能配置主要涉及php.ini配置文件中的upload_tmp_dir、upload_max_filesize、post_max_size等选项,下面一一说明。打开php.ini配置文件找到File Upl...2015-10-21
  • C#使用StreamWriter写入文件的方法

    这篇文章主要介绍了C#使用StreamWriter写入文件的方法,涉及C#中StreamWriter类操作文件的相关技巧,需要的朋友可以参考下...2020-06-25
  • ant design中upload组件上传大文件,显示进度条进度的实例

    这篇文章主要介绍了ant design中upload组件上传大文件,显示进度条进度的实例,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧...2020-10-29
  • php实现文件下载实例分享

    举一个案例:复制代码 代码如下:<?phpclass Downfile { function downserver($file_name){$file_path = "./img/".$file_name;//转码,文件名转为gb2312解决中文乱码$file_name = iconv("utf-8","gb2312",$file_name...2014-06-07