| 제목 | 클래스 사용하기 | ||
|---|---|---|---|
| 글쓴이 | 불꽃코딩 | 작성시각 | 2010/03/21 22:40:06 |
|
|
|||
|
아래와 같이 클래스를 만들고 /application/libraries/ Ciboard_common.php
if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
class Ciboard_common
{
function Ciboard_common()
{
//생성자
}
// 경고메세지를 경고창으로
function alert($msg='', $url='')
{
if (!$msg) $msg = '올바른 방법으로 이용해 주십시오.';
//header("Content-Type: text/html; charset=$g4[charset]");
echo "<meta http-equiv=\"content-type\" content=\"text/html; charset=$g4[charset]\">";
echo "<script language='javascript'>alert('$msg');";
if (!$url)
echo "history.go(-1);";
echo "</script>";
if ($url)
// 4.06.00 : 불여우의 경우 아래의 코드를 제대로 인식하지 못함
//echo "<meta http-equiv='refresh' content='0;url=$url'>";
$this->goto_url($url);
exit;
}
function goto_url($url)
{
echo "<script language='JavaScript'> location.replace('$url'); </script>";
exit;
}
}
controllers 에서 아래와 같이 사용하였습니다.
$this->load->library('Ciboard_common');
$this->Ciboard_common->alert("123");
이렇게 하면 뭐라도 떠야 하는거 아닌지요? 아래와 같이 오류가 나는데 클래스를 제대로 인식못해오는거 같습니다. 어쩌면, 제가 만든 클래스가 잘못되었을수도 있고요 A PHP Error was encounteredSeverity: Notice Message: Undefined property: Board::$Ciboard_common Filename: controllers/board.php Line Number: 67 Fatal error: Call to a member function alert() on a non-object in E:\APM_Setup\htdocs\006.ci_test\app_test01\modules\board\controllers\board.php on line 67 답변 주시면 감사하겠습니다. ^^ |
|||
| 다음글 | 삭제기능 넣어보려고 하는데 좀 막막해요. (1) | ||
| 이전글 | [초보]ci_session데이터 (1) | ||
|
변종원(웅파)
/
2010/03/22 00:02:40 /
추천
0
|
|
불꽃코딩
/
2010/03/22 00:34:00 /
추천
0
빠른 답변 주셔서 감사합니다 ^^;
잘되네요... |
매뉴얼을 조금 더 읽어보심이.....
그리고 에러 메세지에도 나와있구요.
클래스 만들때는 대문자로 시작하지만 실제 불러오는 것은 소문자입니다.
$this
->load->library('ciboard_common');