开发者

echo an <img> tag

开发者 https://www.devze.com 2023-01-09 22:37 出处:网络
I\'m going crazy trying to echo an <img> tag. I want to add this simple string \"/uploads/\" before $photo->name.

I'm going crazy trying to echo an <img> tag.

I want to add this simple string "/uploads/" before $photo->name.

Here is my echo: echo '<img src="'.$photo->开发者_开发技巧name.'"/>';

Thanks for any help.


Not sure if I completely understand, but try this:

echo '<img src="/uploads/'.$photo->name.'"/>';


Here you go: echo '<img src="/uploads/'.$photo->name.'"/>';

Or:

echo '<img src="' . '/uploads/' . $photo->name.'"/>';

Or:

echo '<img src="' . "/uploads/" . $photo->name.'"/>';


echo '<img src="/uploads/'.$photo->name.'"/>';


How about

 echo '<img src="/uploads/'.$photo->name.'"/>';

... unless I'm missing something?


two ways to use echo tag

1st : one is double quotes which use for out put of strings

echo "your name is".$name //here name is variable

2nd : one is single quotes in which you can use all html tags here is the example

  <?php

     $name="Adil";
     echo $name;
     for($i=0;$i<44;$i++)
     {
       echo($i.'<br>')     ;
       if($i==10)
       {
         echo ' <table border=3> <tr><td><h1>its image </h1><img src="examp.png" alt="loading" /><td><td>hello</td><tr></table>';

       }
     }
     ?>

here i am using multiple tags in echo using

single quotes

if put double quotes then you will see following error Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in C:\xampp\htdocs\Untitled2d.php on line 21

here is the output

echo an <img> tag

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号