问题描述
为什么我要为一个学校项目搞乱一些东西,并遇到了一个我自己无法解决的问题,所以这里是我的问题。得到这个错误?
解析错误:语法错误,意外的'$ output2'(T_VARIABLE),期望','或';'在D: \ Webserver \httpdocs\hosting-schultz.ch\test.hosting-schultz.ch\httpdocs\david.ettinger\search.php on line 29
该网站托管于
在
<!DOCTYPE HTML PUBLIC - // W3C // DTD HTML 4.01 Transitional // ENhttp://www.w3.org/TR/html4/loose.dtd\">
< html>
< head>
< title>< / title>
< meta name =authorcontent =David Ettinger>
< meta name =editorcontent =html-editor phase 5>
< / head>
< body text =#000000bgcolor =#FFFFFFlink =#FF0000alink =#FF0000vlink =#FF0000>
//创建用于显示第一个和第二个img的img代码
$ part1 ='< img src =';
$ part2 =(string)$ _ GET [suche];
$ part3 ='.pngalt =404 image not found>';
//为第一张图片创建字符串
$ output1 = $ part1。$ part2。$ part3;
echo $ output;
//< br>使404可读
echo'< br>'
//为第二张图片创建字符串
$ output2 = $ part1。$第2部分{1} $ 3部分。 < ---这是行29
echo $ output2;
?>
< / body>
< / html>
我基本上会使用suche的url参数,显示名为suche.png的第一张图片。并且我想显示第二个图像,第二个字符是suche,例如1234 - >我正在寻找2,我尝试用part2 {1}来做到这一点。
一切正常,直到我尝试添加第二张图片,希望你好绅士可以让它再次工作。
非常感谢您的帮助!
干杯
echo'< br>'<冒号
Im messing around with some stuff for a school project and ran into a problem i failed to solve on my own, so here is my question.
Why do i get this error?
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
The site is hosted on http://test.hosting-schultz.ch/david.ettinger/search.php?suche=T3ST
At the moment, here is the relevant code:
<!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>
I basically take the url parameter of suche, display the first image with the name suche.png. and i want to display a second image with the second char of suche e.g. "1234" -> I'm looking for 2 and i try to do that with part2{1}.
Everything worked fine until I tried adding the second image, hopefully you fine gentleman can make it work again..
Thanks very much in advance for your help!
Cheers
echo '<br>' // <-- missing semi-colon
这篇关于解析错误,为什么? :(的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!