为什么此代码在我尝试访问$sector_value['sector_info']['purchase_order'];
的行上出错?但不是在我打印出变量$sector_counter
的第五行?
//SECTOR
$email_body .= <<<SECTOR_DETAILS
<tr>
<td colspan="2">
Sector $sector_counter;
</td>
</tr>
<tr>
<td colspan="2">
Purchase order
</td>
</tr>
<tr>
<td colspan="2">
$sector_value['sector_info']['purchase_order'];
</td>
</tr>
<tr>
<td>
Proof
</td>
</tr>
SECTOR_DETAILS;
这是错误:
解析错误:语法错误,意外T_ENCAPSED_AND_WHITESPACE,期待第44行/home/www2isco/public_html/test/bch/queries/submit_order.php中的T_STRING或T_VARIABLE或T_NUM_STRING
谢谢!
答案 0 :(得分:6)
将变量括在{ .. }
中,它位于the docs。
//SECTOR
$email_body .= <<<SECTOR_DETAILS
<tr>
<td colspan="2">
Sector $sector_counter;
</td>
</tr>
<tr>
<td colspan="2">
Purchase order
</td>
</tr>
<tr>
<td colspan="2">
{$sector_value['sector_info']['purchase_order']}
</td>
</tr>
<tr>
<td>
Proof
</td>
</tr>
SECTOR_DETAILS;