php 헛다리/CI4 헛다리 (17) 썸네일형 리스트형 ci4 session 세션 // 세션에 사용자 정보 저장 $sess_arr = [ 'admin_100_pk' => $arr_SQL_Result[0]['admin_100_pk'], 'admin_100_id' => $arr_SQL_Result[0]['admin_100_id'], 'admin_100_name' => $arr_SQL_Result[0]['admin_100_name'], 'admin_100_email' => $arr_SQL_Result[0]['admin_100_email'], 'logged_in' => true ]; $session = session(); // 세션로드 .. ci4 쿼리빌더 ci4 쿼리빌더쿼리 확인SELECT 쿼리: getCompiledSelect()INSERT 쿼리: getCompiledInsert()UPDATE 쿼리: getCompiledUpdate()DELETE 쿼리: getCompiledDelete()select Array ( [sqlLike] => Array ( [admin_100_id] => 1 ) [orderBy] => admin_100_pk desc )$builder = $this->db->table($this->table); // table$builder->select('admin_100_default.*'); // select$builder->where($arrData['sqlWhere']);$builder->like($arrData['sqlLi.. ci4 widget 위젯 ci4 widget 위젯 /app/Libraries/MyWidget.phpparser = \Config\Services::parser(); // 파서 사용 } public function test() { // 필요한 로직 작성 (데이터 가공, 모델 호출 등) $arr_VARIABLE_DATA['widget_data'] = "widget_0001"; return $this->parser->setData($arr_VARIABLE_DATA, 'raw')->render("widgets/my_widget_view"); // setData 에 raw 해야 html 태그 정상출력 / render( 출력파일 ) }}/app/Views/widge.. ci4 redirect함수 ci4 redirect함수return redirect()->to("/dashboard/dashboard_list");기본자동 라우트 사용$this->response->redirect("/index.php/Dashboard_default/dashboard"); ci4 라우터 url 설정 ci4 라우터 url 설정 라우터 url 설정 예시/app/Config/Routes.php$routes->get('test', 'TestDefaultController::index');$routes->get('test/view', 'TestDefaultController::view'); URI 라우팅(Routing) — CodeIgniter 4.2.11 documentation (cikorea.net) URI 라우팅(Routing) — CodeIgniter 4.2.11 documentation경로(route)를 만드는 모든 메소드(add, get, post, resource etc)는 생성된 경로를 수정하거나 추가로 제한할 수 있는 옵션을 배열로 취할 수 있습니다. $options 배열은 항.. ci4 에러 제대로 안뜰때 ci4 에러 제대로 안뜰때프로젝트 경로에 .env CI_ENVIRONMENT = development 로 변경#CI_ENVIRONMENT = production // 운영 CI_ENVIRONMENT = development // 개발 ci4 Helpers 사용법 - function autoload ci4 Helpers 사용법 - function autoload 1. /app/Helpers 폴더생성 2. 파일 생성 /app/Helpers/tuning_helpers.php 3. autoload 등록/app/Config/Autoload.php/*** -------------------------------------------------------------------* Helpers* -------------------------------------------------------------------* Prototype:* $helpers = [* 'form',* ];** @var list*/// public $helpers = [];public $helpers = ['tuni.. CI4 db설정 방법 - mariadb 사용 mariadb사용/app/Config/Database.php */ public array $default = [ 'DSN' => '', 'hostname' => 'localhost', 'username' => '', '', '', 'MySQLi', 'DBPrefix' => '', 'pConnect' => false, 'DBDebug' => true, 'charset' => 'utf8mb4', 'DBCollat' => 'utf8mb4_general_ci', 'swapPre' => '', .. 이전 1 2 3 다음 목록 더보기