How can I insert generated captcha image from subfolder? In index.php there is include login.php and this login.php contains an insertion to display captcha image:

<tr>
    <td><?php echo '<images src="captcha.php?w=110&h=40&c=6" >'; ?></td>
    <td><input type="text" name="captcha" /></td>
</tr>

The captcha.php generates the image, and if I call this php direct it displays the image. If I place all file next to index.php it works great, but I want separate all file in core folder except index.php.

有帮助吗?

解决方案

You're referencing the file in an absolute location. Use the relative path instead, then all files that use this code will adjust according to server rules instead of their geographical location.

So instead of

src="captcha.php..."

use

src="/root/path/captcha.php..."

with /root/path/ of course being wherever your documents are on the server relative to your $_SERVER['DOCUMENT_ROOT']

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top