2

アクセスしようとしている行でこのコードがエラーになるのはなぜ$sector_value['sector_info']['purchase_order'];ですか? しかし、変数を出力する5行目ではありません$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、/home/www2isco/public_html/test/bch/queries/submit_order.php の 44 行目に T_STRING または T_VARIABLE または T_NUM_STRING が必要です

ありがとう!

4

1 に答える 1

6

Enclose the variable in { .. }, it's in 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;
于 2012-11-25T20:40:36.533 に答える