、すなわちアタッチ:
<?php
//application/logmessage/log.phtml//
require_once 'Zend/Log.php';
require_once 'Zend/Log/Writer/Stream.php';
class Logger {
/**
* Array variable store full file back trace information.
*
* @access protected
*/
protected $backTrace = array();
/**
* Array variable store full message information.
*
* @access protected
*/
protected $messageInfo = array();
/**
* Constructor: loads the debug and error logs.
*
*/
public function __construct($type, $msg) {
$mock = new Zend_Log_Writer_Mock;
$logger = new Zend_Log($mock);
$logger->$type($msg);
// Get full message information.
array_push($this->messageInfo, $mock->events[0]);
// Get full information of file, from where the message come.
array_push($this->backTrace, debug_backtrace());
// Set all required informationn in their respective variables.
$messageText = $this->messageInfo[0]["message"];
$priority = $this->messageInfo[0]["priorityName"];
$backTraceFile = $this->backTrace[0][0]["file"];
$backTraceLine = $this->backTrace[0][0]["line"];
$logArray = array("Message" => $messageText, "Priority" => $priority,
"Line" => $backTraceLine, "File" => $backTraceFile);
}
}
?>
は、今私は、フォームと一緒に$ logArray配列を表示したいと、私のフォームファイルは次のようです:
<?php
//application/views/scripts/miscellaneous/index.phtml//
//require_once('../application/logmessage/log.phtml');
echo $this->form;
?>
Log Arrayをフォームで表示するにはどうすればよいですか....?
私は http://framework.zend.com/manual/en/zend.registry.htmlを訪問私は "アプリケーション/ LogMessageに/ log.phtml" から に)$ logArray(返すことができますどのように "アプリケーション/ビュー/スクリプト/その他の/ index.phtmlを"
を作成するために、カスタムヘルパーと
print_r
を置き換えることを忘れていけませんか? – UpTheCreek