
ssh2_scp_send 함수는 SCP를 통해 파일을 전송하는 함수입니다. 이 함수의 첫 번째 인자는 로컬 파일 경로를 나타내는 string입니다. 두 번째 인자는 원격 서버의 디렉토리 경로를 나타내는 string입니다.
local_path와 remote_path는 두 개의 서로 다른 변수입니다. local_path는 로컬 컴퓨터의 파일 경로를 나타내는 string입니다. remote_path는 원격 서버의 디렉토리 경로를 나타내는 string입니다.
ssh2_scp_send 함수를 사용하여 파일을 전송하는 예제는 다음과 같습니다.
#hostingforum.kr
php
$ssh = ssh2_connect('example.com', 22);
ssh2_auth_password($ssh, 'username', 'password');
$remote_dir = '/remote/directory/';
$local_file = '/local/file.txt';
$scp = ssh2_scp_send($ssh, $local_file, $remote_dir);
이 예제에서 $local_file은 로컬 컴퓨터의 파일 경로를 나타내고, $remote_dir는 원격 서버의 디렉토리 경로를 나타냅니다. ssh2_scp_send 함수는 로컬 파일을 원격 서버의 디렉토리에 전송합니다.
2025-07-17 14:21