Home > Backend Development > PHP Tutorial > PHP代码不知道哪里错了。

PHP代码不知道哪里错了。

WBOY
Release: 2016-06-06 20:52:18
Original
1091 people have browsed it

原来代码是这样的:

<?php list($width, $height, $type, $attr) =
   getimagesize("http://".Asaph_Config::$domain.$p['image']);
?>
<a href="<?php%20echo%20%24p%5B'source'%5D;%20?>" title="查看原图">
   <img  src="/phpthumb/phpThumb.php?src=<?php%20echo%20%24p%5B'image'%5D;%20?>&w=192" echo alt="PHP代码不知道哪里错了。" > alt="<?php echo $p['title']; ?>"/>
</a>
Copy after login
Copy after login

现在需要改变getimagesize对象图片的路径,改用phpthumb的路径。

<?php list($width, $height, $type, $attr) =
   getimagesize("http://".Asaph_Config::$domain.$p['image']);
?><p>里面的</p><pre class="brush:php;toolbar:false">"http://".Asaph_Config::$domain.$p['image']
Copy after login
Copy after login

修改成

/phpthumb/phpThumb.php?src=<?php echo $p['image']; ?>&w=192
Copy after login
Copy after login

但是我修改了之后,程序提示

Parse error: syntax error, unexpected T_STRING in /home/bigwar/domains/blog.fengyiyi.com/public_html/u/templates/huaban/posts.html.php on line 87

回复内容:

原来代码是这样的:

<?php list($width, $height, $type, $attr) =
   getimagesize("http://".Asaph_Config::$domain.$p['image']);
?>
<a href="<?php%20echo%20%24p%5B'source'%5D;%20?>" title="查看原图">
   <img  src="/phpthumb/phpThumb.php?src=<?php%20echo%20%24p%5B'image'%5D;%20?>&w=192" echo alt="PHP代码不知道哪里错了。" > alt="<?php echo $p['title']; ?>"/>
</a>
Copy after login
Copy after login

现在需要改变getimagesize对象图片的路径,改用phpthumb的路径。

<?php list($width, $height, $type, $attr) =
   getimagesize("http://".Asaph_Config::$domain.$p['image']);
?><p>里面的</p><pre class="brush:php;toolbar:false">"http://".Asaph_Config::$domain.$p['image']
Copy after login
Copy after login

修改成

/phpthumb/phpThumb.php?src=<?php echo $p['image']; ?>&w=192
Copy after login
Copy after login

但是我修改了之后,程序提示

Parse error: syntax error, unexpected T_STRING in /home/bigwar/domains/blog.fengyiyi.com/public_html/u/templates/huaban/posts.html.php on line 87

楼上少了一个),应该是

<?php list($width, $height, $type, $attr) = getimagesize("/phpthumb/phpThumb.php?src=".$p['image']."&w=192"); ?>
Copy after login

同时楼主需要注意/phpthumb指定的是根目录的phpthumb文件夹的说~
楼主之前的写法应该是<?php ?>中又写了<?php ?>标记造成的吧~

<?php list($width, $height, $type, $attr) = getimagesize("/phpthumb/phpThumb.php?src=".$p['image']."&w=192"; ?>
Copy after login
Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template