Deprecated: Optional parameter $keys declared before required parameter $cms_id is implicitly treated as a required parameter in /home/www/dev/work/class/blog/CmsKey.php on line 75

Deprecated: Creation of dynamic property lvesu\lvesu\controller\blog\php::$title is deprecated in /home/www/dev/work/website/lvesu/class/controller/blog/php.php on line 28

Deprecated: Creation of dynamic property lvesu\lvesu\controller\blog\php::$outlink is deprecated in /home/www/dev/work/website/lvesu/template/blog/cms/php.manual.tpl on line 2

Deprecated: Creation of dynamic property lvesu\lvesu\controller\blog\php::$status is deprecated in /home/www/dev/work/website/lvesu/template/blog/index.head.php on line 2
PHP - Manual: svn_commit - 互联网笔记

略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: svn_commit

2025-05-04

svn_commit

(PECL svn >= 0.1.0)

svn_commit将修改的本地文件副本发送至版本库

说明

svn_commit(string $log, array $targets, bool $recursive = true): array

提交本地文件副本的改变使用参数 targets ,使用 log 参数作为提交日志,targets 参数默认使用递归,recursive 参数设置为 false 将不使用递归。

注意: 此方法没有指定任何认证参数,用户名和密码必须使用 svn_auth_set_parameter()

参数

log

长文本的提交日志

targets

本地文件路径数组

警告

此参数必须是一个数组,一个单一字符串是不被接收的。

注意: 相对路径将会以PHP执行文件所在目录作为当前工作目录进行解析。如果希望依据脚本所在目录解析, 使用realpath() 或 dirname(__FILE__)。

recursive

布尔类型,是否禁用 targets 递归。默认值为 true

返回值

返回数组信息如下:

array(
    0 => 提交版本号
    1 => ISO 8601 格式的提交时间
    2 => 提交者
)

失败返回 false

示例

示例 #1 基本示例

这个例子是将一个计算程序目录提交到一个版本库,使用用户名为 Bob 以及密码为 abc123 (提倡可以使用强密码)

<?php
svn_auth_set_parameter
(SVN_AUTH_PARAM_DEFAULT_USERNAME, 'Bob');
svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_PASSWORD, 'abc123');
var_dump(svn_commit('Log message of Bob\'s commit', array(realpath('calculator'))));
?>

以上示例会输出:

array(
  0 => 1415,
  1 => '2007-05-26T01:44:28.453125Z',
  2 => 'Bob'
)

注释

警告

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担。

参见

添加备注

用户贡献的备注

此页面尚无用户贡献的备注。

官方地址:https://www.php.net/manual/en/function.svn-commit.php

冷却塔厂家 广告
中文GPT4.0无需注册 广告
北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3