我正在为学校项目摆弄一些东西,遇到了一个我自己无法解决的问题,所以这是我的问题。
为什么我会收到此错误?
Parse error: syntax error, unexpected '$output2' (T_VARIABLE), expecting ',' or ';' in D:\Webserver\httpdocs\hosting-schultz.ch\test.hosting-schultz.ch\httpdocs\david.ettinger\search.php on line 29
该网站托管于http://test.hosting-schultz.ch/david.ettinger/search.php?suche=T3ST http://test.hosting-schultz.ch/david.ettinger/search.php?suche=T3ST
目前,相关代码如下:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<meta name="author" content="David Ettinger">
<meta name="editor" content="html-editor phase 5">
</head>
<body text="#000000" bgcolor="#FFFFFF" link="#FF0000" alink="#FF0000" vlink="#FF0000">
<?php
//creates img code for display of first and second img
$part1 = '<img src="';
$part2 = (string)$_GET["suche"];
$part3 = '.png" alt="404 image not found">';
// creates string for first image
$output1 = $part1.$part2.$part3;
echo $output;
// <br> to make both 404 readable
echo '<br>'
// creates string for second image
$output2 = $part1.$part2{1}.$part3; <--- THIS IS LINE 29
echo $output2;
?>
</body>
</html>
我基本上采用 suche 的 url 参数,显示名为 suche.png 的第一张图像。我想显示第二张图像,其中包含 suche 的第二个字符,例如"1234" -> 我正在寻找 2,我尝试用第 2 部分{1}来实现。
一切都工作正常,直到我尝试添加第二张图片,希望你的好绅士能让它再次工作。
预先非常感谢您的帮助!
Cheers
echo '<br>' // <-- missing semi-colon
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)