프로그래밍/PHP

$request->user()?->id ?: $request->ip() 1. 널 세이프 연산자 (?->)- $request->user()?->id는 안전한 메소드 체이닝을 제공합니다.- user()가 null을 반환하면, 에러 없이 전체 표현식이 null이 됩니다.- 로그인하지 않은 사용자의 경우 user()가 null을 반환합니다.  $request->user()?->id // 예: 123 // 123을 반환 2. 널 병합 연산자 - 왼쪽 값이 null이거나 false면 오른쪽 값을 사용합니다.- A ?: B는 A ?? B 또는 A ? A : B의 축약형 입니다 인증된 사용자 또는 IP
PHP 프로젝트에 사용되거나 사용되어야 할 라이브러리들을 기록하고 설치할 수 있게 해줌.PHP 버전에 따른 패키지 설치 버전을 자동으로 정리해준다.  컴퓨터에 composer 를 설치하고 터미널에 composer 명령어를 통해서 composer.json에 기록된 내용을 확인하고 패키지를 자동으로 다운로드 한다. 또는 원하는 패키지를 설치하고 설치된 버전을 composer.json 에 기록해 준다. 이러한 일련의 작업은, 버전에 따른 충돌 오류를 없애주고 언제든 기존 작업을 그대로 재현하기 위해서 탄생하였다. 핵심요약 :[명령어 설명] composer init   [생성하는 파일 설명]composer.json composer.lock  composer require composer remove compos..
foreach ( $items as $item) key와 value 가 필요한 경우 foreach ( $items as $key => $item )
$response->setParameter('foo', 'bar'); sConfig::set('foo', 'bar'); 차이점은 ? -> 는 주로 인스턴의 멤버를 호출할때.. :: 는 주로 정적 멤버를 호출할때..(static) class Example { public static function hello(){ echo 'hello'; } public function world(){ echo 'world'; } } // Static method, can be called from the class name Example::hello(); // Instance method, can only be called from an instance of the class $obj = new Example(); $o..
1. html 문서에서..php 사용법 변수는 달러표시를 사용해서 만든다 $변수 문장이 끝날때는 항상 세미콜론(;) 을 입력한다. echo $name; include, require 차이점.. include 는 파일이 없어도 계속진행..에러가 나지 않고 진행 require 는 파일이 없으면 에러발생..둘다 사용법은 동일 include_once, require_once 한번만 파일이 포함됨.
https://www.w3schools.com/php/php_ref_string.asp PHP String Functions W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more. www.w3schools.com
에그티비
'프로그래밍/PHP' 카테고리의 글 목록