質問

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