라벨이 PHP인 게시물 표시

[Querydsl] 멀티 DB (Multi DB) 연결, 설정하기

1. application.yml에 데이터소스 추가하기 Spring Boot 프로젝트에서 두 개의 데이터베이스를 사용하기 위해 application.yml 파일에 각각의 데이터소스를 정의해줍니다. spring: datasource: driverClassName: org.mariadb.jdbc.Driver url: jdbc:mariadb://localhost:3306/{DB명} username: {DB user} password: {DB password} second-datasource: driverClassName: org.mariadb.jdbc.Driver url: jdbc:mariadb://localhost:3306/{DB명} username: {DB user} password: {DB password} 2. 데이터소스 설정 1) 첫 번째 데이터베이스 설정 기본 데이터베이스 설정을 위해 @Primary 어노테이션을 사용해야 하며, 관련된 설정을 아래와 같이 구성합니다. @Configuration @EnableTransactionManagement @EnableJpaRepositories( basePackages = ["패키지1", "패기지2"], entityManagerFactoryRef = "entityManagerFactory", transactionManagerRef = "transactionManager" ) class DatasourceConfig { @Bean @Primary @ConfigurationProperties("spring.datasource") fun datasourceProperties(): DataSourceProperties { return DataSourceProperties() ...

[PHP] AWS S3 sdk 파일 업로드 하기

 1. AWS S3 SDK 설치 composer require aws/aws-sdk-php compser로 aws-sdk 설치 2. AWS SDK for PHP 소스코드 require 'vendor/autoload.php' ; use Aws \ S3 \ S3Client ; use Aws \ S3 \ Exception \ S3Exception ; $bucket = '*** Your Bucket Name ***' ; $keyname = '*** Your Object Key ***' ; $s3 = new S3Client ([ 'version' => 'latest' , 'region' => 'us-east-1' ]); try { // Upload data. $result = $s3 -> putObject ([ 'Bucket' => $bucket , 'Key' => $keyname , 'Body' => 'Hello, world!' , 'ACL' => 'public-read' ]); // Print the URL to the object. echo $result [ 'ObjectURL' ] . PHP_EOL ; } catch ( S3Exception $e ) { echo $e -> getMessage () . PHP_EOL ; } Key는 업로드할 파일 이름(경로)를 Body에는 데이터를 넣으면 된다  나는 파일을 올릴거라서 조금 수정해서 적용했...