syntax error, unexpected T

I am very new to PHP and have no idea why this is happening, I have looked at other online items, however I just cannot seem to see why I am getting this error.

<?php
include_once('assets/libs/posicloud/posicloud.php');

    $cloud=new posicloud();
    $out='';
    foreach ($cloud->list_templates() as $key=>$template)
    {
$out.='<option value=''.$key.'">'.$value["name"].';
    }
  return $out;
?>

Thankyou for any help!


When you're working with strings in PHP you'll need to pay special attention to the formation, using " or '

$string = 'Hello, world!';
$string = "Hello, world!";

Both of these are valid, the following is not:

$string = "Hello, world';

You must also note that ' inside of a literal started with " will not end the string, and vice versa. So when you have a string which contains ' , it is generally best practice to use double quotation marks.

$string = "It's ok here";

Escaping the string is also an option

$string = 'It's ok here too';

More information on this can be found within the documentation


错误的引用:(和丢失选项结束标签xd)

$out.='<option value="'.$key.'">'.$value["name"].'</option>';

'<option value=''.$key.'">'

应该

'<option value="'.$key.'">'
链接地址: http://www.djcxy.com/p/11968.html

上一篇: PHP解析错误:语法错误,意外的T

下一篇: 语法错误,意外的T