Phinx 是数据库迁移的好工具,它在终端创建表和通过命令将数据播种到其中时工作正常,但我想在插入表之前在浏览器上看到这段代码的一些输出,谁能帮我弄清楚如何把一些 var_dumps 并以某种方式在终端或浏览器中查看输出?
示例代码:
public function up()
{
$userLinks = $this->fetchAll('SELECT * FROM user_links');
var_dump($userLinks);
foreach ($userLinks as $userLink) {
$actionPlugin = ucfirst($userLink['action']);
$actionParams = array();
$actionParams['UserID'] = $userLink['userID'];
if (isset($userLink['userSurveyID'])) {
$actionParams['UserSurveyID'] = $userLink['userSurveyID'];
}
$jsonParamString = json_encode($actionParams);
$this->execute("
INSERT INTO `token_links` (`linkID`, `token`, `actionPlugin`, `actionParams`) VALUES
({$userLink['userLinkID']}, '{$userLink['token']}', '$actionPlugin', '$jsonParamString');
");
}
}