©
本文档使用
php.cn手册 发布
(PECL svn >= 0.1.0)
svn_auth_set_parameter — Sets an authentication parameter
$key
, string $value
)
Sets authentication parameter at key
to value
.
For a list of valid keys and their meanings, consult the
authentication constants list.
key
String key name. Use the authentication constants defined by this extension to specify a key.
value
String value to set to parameter at key. Format of value varies with the parameter.
没有返回值。
此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。
Example #1 Default authentication example
This example configures SVN so that the default username to use is 'Bob' and the default password is 'abc123':
<?php
svn_auth_set_parameter ( SVN_AUTH_PARAM_DEFAULT_USERNAME , 'Bob' );
svn_auth_set_parameter ( SVN_AUTH_PARAM_DEFAULT_PASSWORD , 'abc123' );
?>
[#1] powtac at gmx dot de [2011-06-07 07:38:21]
If you having trouble with certificate verification like this:
PHP Warning: svn_log(): svn error(s) occured 175002 (RA layer request failed) OPTIONS of 'https://example.com/your/repos/path': Server certificate verification failed: issuer is not trusted
Try this two steps:
1. Run
"svn log https://example.com/your/repos/path"
on the commandline and permanent accept the certificate by typing "p" when asked.
2. Use the following settings for svn_auth_set_parameter() before calling other svn functions:
<?php
svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_USERNAME, 'your svn user');
svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_PASSWORD, 'your svn users password');
svn_auth_set_parameter(PHP_SVN_AUTH_PARAM_IGNORE_SSL_VERIFY_ERRORS, true); // <--- Important for certificate issues!
svn_auth_set_parameter(SVN_AUTH_PARAM_NON_INTERACTIVE, true);
svn_auth_set_parameter(SVN_AUTH_PARAM_NO_AUTH_CACHE, true);
var_dump(svn_log('https://example.com/your/repos/path'));
?>
This will work for SVN client libraries below 1.6!