简体   繁体   English

如何在Laravel的自定义配置文件中重复使用现有的数组值?

[英]How can I re-use existing array value in custom config file in Laravel?

Let's say I have the following array in "config/custom.php" 假设我在“ config / custom.php”中有以下数组

return array(
    'svn_host' => "https://MYSERVERNAME",
    'svn_user' => "deployment",
);

Now let's say I add another value, but I want to reuse an existing value from the same array. 现在假设我添加了另一个值,但是我想重用同一数组中的现有值。

return array(
    'svn_host' => "https://MYSERVERNAME",
    'svn_user' => "deployment",
    'cmd' => "svn ls --username [I want to use 'svn_user' here]"
);

Just give it a variable above...its a hack, but it'll work 只是给它上面的一个变量...它是一个hack,但它可以工作

$user = "deployement";
return array(
'svn_host' => "https://MYSERVERNAME",
'svn_user' => $user,
'cmd' => "svn ls --username ".$user
);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Laravel-我可以在控制器中重复使用验证器实例吗? - Laravel - Can I re-use validator instance in the controller? 如何在 phpBB3 中重用现有的数据库连接? - How can I re-use an existing database connection in phpBB3? 如何提取变量的值并重复使用该值,直到其被覆盖 - How can I extract the value of a variable and re-use that value until it is overwritten 有人如何重复使用Cookie? - How someone can re-use cookies? 如何从Laravel中的自定义配置数组添加标题? - how can I add titles from a custom config array in laravel? Laravel-如何重用通过函数传递参数的函数作为参数 - Laravel - how to re-use functions that are passing models in functions as parameters 如何读取存储在 Laravel 的 Config 文件夹中的数据文件中保存的数组值 - How can I read an array value saved in a data file stored inside Config folder in Laravel 如何使用translate laravel配置文件 - How can I use translate laravel config file 如何清理$ _SERVER ['QUERY_STRING'],然后重新使用查询字符串-PHP - How can I sanitise $_SERVER['QUERY_STRING'] and then re-use the query string - PHP 如何在终端之间重用会话Cookie(Android) - How can I re-use a session cookie between terminations (Android)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM