0

こんにちは、文字列であるこの変数を持っています。

$this->product_output_html = <<< HTML

いくつかの HTML コード

  HTML;

クラステストで、このようなphp forループを追加したい

if ($admin->errors) { foreach ($admin->errors as $error) { echo ''.$error.''; } }

追加しようとしましたが、機能していません。class="test"> の後、テストの前に '' を追加しましたが、まだ機能していません。私は何を間違っていますか?

どうもありがとう

4

2 に答える 2

0

交換

echo ".$error.";

echo $error;
于 2012-11-03T00:39:24.797 に答える
0

のようなものを試してください

$this->product_output_html = 'Start of html code as a string';
if ($admin->errors) {
  foreach ($admin->errors as $error) {
    $this->product_output_html .= '<br />'.$error;
  }
}
$this->product_output_html .= '<br />End of html code as a string';
echo $this->product_output_html;
于 2012-11-03T00:43:11.790 に答える