用PHP返回图片文件的内容是不是增加很多服务器的负担?保护私人相册有没有好的方法?解决方法
用PHP返回图片文件的内容是不是增加很多服务器的负担?保护私人相册有没有好的方法?
我是PHP的初学者,用Zend Framework,现在有个问题,要做个相册,
可以设置为不公开的,图片是保存在文件系统里,
我的想法是,公开的图片就放在public的文件夹里,随便什么人可以直接浏览的,不需要php的处理。
如果是用户的私人相册,图片的url是在zend框架的控制下的,本人登录才能看。
但这个图片文件的内容需要用php动态返回的吧?会不会增加很多服务器的负担?
有没有什么好方法?apache的mod_rewrite能不能控制的?
------解决方案--------------------
安全一般都需要牺牲性能
经php读取是其中一个简单的保护方法
可以选择只应用于保密档案
其它都用web server直接读取
------解决方案--------------------
令用户不能直接存取就可以了
没有绝对的保密
花多点时间令用户自己注意保护密码会有更好的效果
如限制密码重试次数等
------解决方案--------------------
但这个图片文件的内容需要用php动态返回的吧?会不会增加很多服务器的负担?
是的,要动态返回,会一定程度上增负担,因为要处理,要占内存
有没有什么好方法?apache的mod_rewrite能不能控制的?
重写不能控制,只要你在IE能看到,重写后仍然能看到,只有登录验证显示PHP输出才行!
你看CSDN的个人图片,都是没有保护的!
------解决方案--------------------
安全就是要牺牲一部分性能,但是这些性能不会很大。
重写是解决不了问题的,因为不能判断,它只是一个正则表达式。
用PHP控制图片的输出,之前用PHP判断是否登录,是否有权限,再输出,这个是逻辑,你可以根据此逻辑制作一个程序。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



PHP and Python each have their own advantages, and choose according to project requirements. 1.PHP is suitable for web development, especially for rapid development and maintenance of websites. 2. Python is suitable for data science, machine learning and artificial intelligence, with concise syntax and suitable for beginners.

To set up a CGI directory in Apache, you need to perform the following steps: Create a CGI directory such as "cgi-bin", and grant Apache write permissions. Add the "ScriptAlias" directive block in the Apache configuration file to map the CGI directory to the "/cgi-bin" URL. Restart Apache.

PHP is still dynamic and still occupies an important position in the field of modern programming. 1) PHP's simplicity and powerful community support make it widely used in web development; 2) Its flexibility and stability make it outstanding in handling web forms, database operations and file processing; 3) PHP is constantly evolving and optimizing, suitable for beginners and experienced developers.

The steps to start Apache are as follows: Install Apache (command: sudo apt-get install apache2 or download it from the official website) Start Apache (Linux: sudo systemctl start apache2; Windows: Right-click the "Apache2.4" service and select "Start") Check whether it has been started (Linux: sudo systemctl status apache2; Windows: Check the status of the "Apache2.4" service in the service manager) Enable boot automatically (optional, Linux: sudo systemctl

PHP is used to build dynamic websites, and its core functions include: 1. Generate dynamic content and generate web pages in real time by connecting with the database; 2. Process user interaction and form submissions, verify inputs and respond to operations; 3. Manage sessions and user authentication to provide a personalized experience; 4. Optimize performance and follow best practices to improve website efficiency and security.

When the Apache 80 port is occupied, the solution is as follows: find out the process that occupies the port and close it. Check the firewall settings to make sure Apache is not blocked. If the above method does not work, please reconfigure Apache to use a different port. Restart the Apache service.

PHP is widely used in e-commerce, content management systems and API development. 1) E-commerce: used for shopping cart function and payment processing. 2) Content management system: used for dynamic content generation and user management. 3) API development: used for RESTful API development and API security. Through performance optimization and best practices, the efficiency and maintainability of PHP applications are improved.

This article discusses how to improve Hadoop data processing efficiency on Debian systems. Optimization strategies cover hardware upgrades, operating system parameter adjustments, Hadoop configuration modifications, and the use of efficient algorithms and tools. 1. Hardware resource strengthening ensures that all nodes have consistent hardware configurations, especially paying attention to CPU, memory and network equipment performance. Choosing high-performance hardware components is essential to improve overall processing speed. 2. Operating system tunes file descriptors and network connections: Modify the /etc/security/limits.conf file to increase the upper limit of file descriptors and network connections allowed to be opened at the same time by the system. JVM parameter adjustment: Adjust in hadoop-env.sh file
