(PECL svn >= 0.1.0)
svn_add — 計劃在工作目錄添加項
$path
, bool $recursive
= true, bool $force
= false): bool
添加文件, 目錄或者鏈接在路徑
到工作目錄。將在下一次執行svn_commit()
時(shí)把工作副本添加到項目中。
path
添加項的路徑。
注意: 相對路徑將會(huì )以PHP執行文件所在目錄作為當前工作目錄進(jìn)行解析。如果希望依據腳本所在目錄解析, 使用realpath() 或 dirname(__FILE__)。
recursive
如果添加項為目錄是否遞歸目錄下所有文件。 默認為 true
force
If true, Subversion will recurse into already versioned directories
in order to add unversioned files that may be hiding in those
directories. Default is false
成功時(shí)返回 true
, 或者在失敗時(shí)返回 false
。
此函數是實(shí)驗性的。此函數的表象,包括名稱(chēng)及其相關(guān)文檔都可能在未來(lái)的 PHP 發(fā)布版本中未通知就被修改。使用本函數風(fēng)險自擔。
示例 #1 svn_add() 例子
在工作目錄使用命令 svn status
返回值:
$ svn status ? foobar.txt
...代碼:
<?php
svn_add('foobar.txt');
?>
...計劃 foobar.txt 文件添加到版本庫。