Tuesday, September 20, 2011

[CI] firePHP

FireFox의 AddIn으로서
PHP 프로젝트에서 로그를 FireFox의 Console에 나타나도록 한다

1. firephp: FireFox Add-In
FireFox에서 http://firephp.org/ 를 방문하여 설치

2. FirePHP Server Library
http://www.firephp.org/HQ/Install.htm
다운 받은 firePHP core library의 압축을 풀어 줍니다. 그리고 application/libraries 디렉토리에 FirePHP.class.php파일을 복사 해 주고, 파일의 이름을 firephp.php로 바꿔 줍니다.

<>사용법
$this->firephp->log($myvariable) : FireBug console에 $myvarriable 값의 덤프를 보냄.
$this->firephp->warn($myvariable) : FireBug console에 $myvarriable 값의 덤프를 warning으로 분류해서 보냄.
$this->firephp->error($myvariable) : FireBug console에 $myvarriable 값의 덤프를 error으로 분류해서 보냄.

$this->load->library('firephp');
$myvariable = array (
'language' => 'PHP',
'database' => 'MySQL',
'blogging platform' => 'WordPress',
'post' => 'CodeIgniter and FirePHP',
);
$this->firephp->log($myvariable);
?>

<>특정 IP만 가능하게 하기
if($this->input->ip_address() =='1.2.3.4')
{
$this->firephp->setEnabled(TRUE);
}
else
{
$this->firephp->setEnabled(FALSE);
}
?>

No comments:

Post a Comment