본문 바로가기
  • AI (Artificial Intelligence)

2017/078

How to read a value from JSON using PHP? JSON (JavaScript Object Notation) is a convenient, readable and easy to use data exchange format that is both lightweight and human-readable(like XML, but without the bunch of markup). If you have a json array and want to read and print its value, you have to use php functionjson_decode(string $json, [optional{true, false}]). If you pass a valid JSON string into the json decode function, you wil.. 2017. 7. 27.
[기초 정리] PHP Framework, CodeIgniter 시작하기 [2부] [1부]에 이어서 시작합니다. 4. CI 경로 설정하기. CI를 시작하기 위해서는 기본 경로를 설정해 줘야 합니다. system/application/config/config.php 파일을 열어서... 'base_url'을 아래와 같이 수정해 줍니다. $config['base_url'] = "http://localhost/ci/"; 정상적으로 설치가 되었으면 아래와 같이 나옵니다. 5. MySQL 연결 설정하기. 데이터 베이스의 연결이 설정 되어 있는데로 설정르 합니다. 파일은 system/application/config/database.php 입니다. 이번 포스팅에서 사용할 db는 helloworld이고 사용자아이디와 암호는 "root"로 했습니다. $db['default']['hostname'] =.. 2017. 7. 21.
[기초정리 잘 됨] [PHP] Codeigniter (코드이그나이터) Model CI의 Model에 대해서 정리합니다. MVC 디자인 패턴에서 M인 Model은 데이터를 담당합니다. 데이터란 보통 데이터베이스를 말하고 있습니다.데이터를 다루는 로직을 따로 모델로 모아두어 데이터의 입출력과 화면을 관리하는 뷰를 격리 시켜좀 더 편리하게 작업할 수 있는 환경을 그리고 호환성있게 만들어줄수 있습니다. 1. 데이터베이스 설정 Model을 사용하기 위해 CI의 데이터베이스 설정입니다.Application/config/database.php 파일을 수정해야합니다.주요 내요한 몇가지 설정만 해주시면 됩니다. hostname : 데이터베이스 서버의 주소username : 데이터베이스 사용자의 이름password : 데이터베이스 비밀번호database : 데이터베이스 명dbdriver : 데이터베이.. 2017. 7. 21.
[Codeigniter DB 연동] 2. Codeigniter 셋팅 1. DB 정보 셋팅 2. DB 관련 라이브러리 로드 3. 모델 파일 생성 application/models/testdb_model.php 2017. 7. 21.
[확인 안됨] 배열 stdclass <-> array 변환 배열 stdclass array 변환 그게 바로 stdClass 때문인데.. stdClass = 문자열인덱스 배열 구조라고 한다. 예) a -> val = "value"; --------------------------------------------------------------------------- stdClass 는 Json 을 사용할때도 사용 되기도 한다. 스크립트에서 ajax 사용시 넘기는 데이터 타입을 json 으로 지정하면 넘어가는 데이터가 stdClass로 넘어간다. 이럴경우 일반 배열로 다시 변환 하고 싶다면... json_decode($aa,true); 로 선언하면 된다. 12345678910111213141516171819202122232425262728293031323334353.. 2017. 7. 21.
[MySQL] 8.1.1 Obtaining Auto-Increment Values Obtaining the value of column that uses AUTO_INCREMENT after an INSERT statement can be achieved in a number of different ways. To obtain the value immediately after an INSERT, use a SELECT query with the LAST_INSERT_ID() function.For example, using Connector/ODBC you would execute two separate statements, the INSERT statement and the SELECT query to obtain the auto-increment value.INSERT INTO t.. 2017. 7. 21.
CodeIgniter GET And POST Form Input Method In this tutorial we will give you brief description about CodeIgniter input post, this is most important part of a web application.It uses an input class of CodeIgniter that provides some helper functions that helps to fetch data and to pre-process it.Form submit can done with two input methods, GET and POST. In this blog, we use default method POST for submit form.CodeIgniter doesn’t support GE.. 2017. 7. 21.
Inheritance between controllers in Codeigniter Today, we will talk about the inheritance between controllers in CodeIgniter. At first glance, it could seem very simple to do and it should not be more complicated than this:class Parent_controller extends Controller { function __construct() { parent::Controller(); ... } ... } class Child_controller extends Parent_controller { function __construct() { parent::__construct(); ... } ... } If we ru.. 2017. 7. 21.