2

为什么此代码在我尝试访问的行上出现错误$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

谢谢!

4

1 回答 1

6

将变量括在 中{ .. },它在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;
于 2012-11-25T20:40:36.533 回答