logo
  • 教程列表
  • SO官方文档
  • 数组
    • 初始化数组
    • 检查密钥是否存在
    • 验证数组类型
    • 创建变量数组
    • 检查数组中是否存在值
    • ArrayAccess 和 Iterator 接口
  1. StackOverflow 文档
  2. PHP 教程
  3. 数组
  4. 创建变量数组

创建变量数组

Created: November-22, 2018

$username = 'Hadibut';
$email = 'hadibut@example.org';

$variables = compact('username', 'email');
// $variables is now ['username' => 'Hadibut', 'email' => 'hadibut@example.org']

此方法通常在框架中用于在两个组件之间传递变量数组。

  • 检查数组中是否存在值
  • 验证数组类型

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 关于我们
  • 免责声明