文件路径问题
我先是绑定一个二级域名m.xxxxxx.com到.../www/mobile 这个文件夹,访问m.xxxxxx.com,实际是访问的.../www/mobile 下的内容,现在问题来了,我访问m.xxxxxx.com,里面的图片路径全部不对,因为我的图片全部放到.../www/system下的,路径我用的相对路径,我访问m.xxxxxx.com,是直接访问到了.../www/mobile下,读取不到.../www/system的文件,如果用绝对路径,要改的地方比较多,插件编辑器里面的图片,视频等路径都要改,比较麻烦,能不能用其他的方法?
回复讨论(解决方案)
你好像没说图片的 url 是怎么写的吧?
你好像没说图片的 url 是怎么写的吧?
我的图片全部放在../www/system下
../system/图片名
和权限有关系吗??? 这样相对路径应该不会有问题的啊
前端读出../system/1433928999.png,即http://m.xxxxxx.com.cn/system/1433928999.png,但是m.xxxxxx.com.cn/,绑定到了../www/mobile,实际路径是../wwww/mobile/system/1433928999.png,这个路径肯定是不对
www 网站的根
www/mobile 程序在这里
www/system 图片在这里
所以 程序访问图片的相对路径写作 ../system/图片名
现在变了
www/mobile 网站的根
www/mobile 程序在这里
www/system 图片在这里
所以 程序访问图片的相对路径写作 ../system/图片名 就错了,因为 system 在网站外面了
你可以设置虚拟目录
ALIAS system/ "www/system"
就可以不用改代码了,注意 www/system 是绝对路径,自己修改
www 网站的根
www/mobile 程序在这里
www/system 图片在这里
所以 程序访问图片的相对路径写作 ../system/图片名
现在变了
www/mobile 网站的根
www/mobile 程序在这里
www/system 图片在这里
所以 程序访问图片的相对路径写作 ../system/图片名 就错了,因为 system 在网站外面了
你可以设置虚拟目录
ALIAS system/ "www/system"
就可以不用改代码了,注意 www/system 是绝对路径,自己修改
Alias /system "D:/xxxx/www/system"
Options FollowSymLinks IncludesNOEXEC Indexes
DirectoryIndex index.php
AllowOverride Options FileInfo
Order Deny,Allow
Allow from all
是这样写的吗?
在此之前,我写了将域名绑定到mobile,会有影响吗?
ServerAdmin webmaster@dummy-host.x
DocumentRoot "D:/xxxx/www/mobile"
ServerName m.xxxxx.com.cn
解决了,谢谢

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











There are four main error types in PHP: 1.Notice: the slightest, will not interrupt the program, such as accessing undefined variables; 2. Warning: serious than Notice, will not terminate the program, such as containing no files; 3. FatalError: the most serious, will terminate the program, such as calling no function; 4. ParseError: syntax error, will prevent the program from being executed, such as forgetting to add the end tag.

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.

In PHP, password_hash and password_verify functions should be used to implement secure password hashing, and MD5 or SHA1 should not be used. 1) password_hash generates a hash containing salt values to enhance security. 2) Password_verify verify password and ensure security by comparing hash values. 3) MD5 and SHA1 are vulnerable and lack salt values, and are not suitable for modern password security.

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.

HTTP request methods include GET, POST, PUT and DELETE, which are used to obtain, submit, update and delete resources respectively. 1. The GET method is used to obtain resources and is suitable for read operations. 2. The POST method is used to submit data and is often used to create new resources. 3. The PUT method is used to update resources and is suitable for complete updates. 4. The DELETE method is used to delete resources and is suitable for deletion operations.

PHP is a scripting language widely used on the server side, especially suitable for web development. 1.PHP can embed HTML, process HTTP requests and responses, and supports a variety of databases. 2.PHP is used to generate dynamic web content, process form data, access databases, etc., with strong community support and open source resources. 3. PHP is an interpreted language, and the execution process includes lexical analysis, grammatical analysis, compilation and execution. 4.PHP can be combined with MySQL for advanced applications such as user registration systems. 5. When debugging PHP, you can use functions such as error_reporting() and var_dump(). 6. Optimize PHP code to use caching mechanisms, optimize database queries and use built-in functions. 7

PHP handles file uploads through the $\_FILES variable. The methods to ensure security include: 1. Check upload errors, 2. Verify file type and size, 3. Prevent file overwriting, 4. Move files to a permanent storage location.

In PHPOOP, self:: refers to the current class, parent:: refers to the parent class, static:: is used for late static binding. 1.self:: is used for static method and constant calls, but does not support late static binding. 2.parent:: is used for subclasses to call parent class methods, and private methods cannot be accessed. 3.static:: supports late static binding, suitable for inheritance and polymorphism, but may affect the readability of the code.
