ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# C.86 ScpTask The `ScpTask` copies files to and from a remote host using scp. This task requires the [PHP SSH2 extension](http://pecl.php.net/package/ssh2) to function. Table C.116:聽Attributes NameTypeDescriptionDefaultRequired`host``String`Remote hostnoneYes`port``Integer`Remote port22No`username``String`Username to use for the connectionnoneYes`password``String`Password to use for the connectionnoneNo`pubkeyfile``String`Public key file (OpenSSH format) to use for the connectionnoneNo`privkeyfile``String`Private key file (OpenSSH format) to use for the connectionnoneNo`privkeyfilepassphrase``String`Private key file passphrase to use for the connectionnoneNo`autocreate``Boolean`Whether to autocreate remote directories`true`No`todir``String`Directory to put file(s) innoneNo`file``String`Filename to usenoneNo`fetch``Boolean`Whether to fetch (instead of copy to) the file`false`No`level``String`Control the level at which the task reports status messages. One of `error`, `warning`, `info`, `verbose`, `debug`.`verbose`No C.86.1 Example ``` <scp username="john" password="smith" host="webserver" fetch="true" todir="/home/john/backup" file="/www/htdocs/test.html" /> ``` Fetches a single file from the remote server. ``` <scp username="john" password="smith" host="webserver" todir="/www/htdocs/" file="/home/john/dev/test.html" /> ``` Copies a single file to the remote server. ``` <scp username="john" password="smith" host="webserver" todir="/www/htdocs/project/"> <fileset dir="test"> <include name="*.html" /> </fileset> </scp> ``` Copies multiple files to the remote server. C.86.2 Supported Nested Tags - `fileset` - `sshconfig` Sometimes it is necessary to set specific configuration parameters on the ssh connection when connecting to a remote server. You can set them with the sshconfig nested tag. Set the parameters to specify connection and encryption options. These are the parameters as specified by the $methods parameter of the ssh2\_connect function. See [ssh2\_connect](http://us3.php.net/ssh2_connect) for more information sshconfig can also be used as project level parameter with a refid so the same parameters can be re-used across a project easily. Table C.117:聽Attributes NameTypeDescriptionDefaultRequired`kex``String`List of key exchange methods to advertise, comma separated in order of preference.n/aNo`hostkey``String`List of hostkey methods to advertise, come separated in order of preference.n/aNo`client``Nested Tag`Element containing attributes crypt, comp, and mac method preferences for messages sent from client to server. All attributes are optional.n/aNo`server``Nested Tag`Element containing attributes crypt, comp, and mac method preferences for messages sent from server to client. All attributes are optional.n/aNo