문제

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