php - 发送邮件前使用 file_put_contents 打印
问题描述
我使用 'wpcf7_posted_data' 挂钩在 Wordpress 中的联系表格 7 后更改了一些数据。我想打印 $array 的内容,所以我尝试使用 file_put_contents() 将其打印到文件中,但是当我尝试发送邮件时,它卡住了,什么也没有……(也没有文件)
如何得到它?
谢谢
add_filter('wpcf7_posted_data', 'action_wpcf7_posted_data', 10, 1);
function action_wpcf7_posted_data($array)
{
$ses = get_field('date');
$sesCount = count($ses["body"]);
$a = "";
for ($i = 0; $i <= $sesCount; $i++) {
if ($ses[$i][1]["c"] == $array['upcoming-gigs']) {
$array['bla'] = strval($ses[$i][0]["c"]);
}
}
file_put_contents('file.txt', var_export($array));
$array['Session'] = $array['upcoming-gigs'];
unset($array['upcoming-gigs']);
return $array;
}
解决方案
将此行从更改file_put_contents('file.txt', var_export($array));
为file_put_contents('file.txt', var_export($array, true));
推荐阅读
- docker - 如何指示不使用 Dockerfile 的私有注册表?
- python - keras NN 100% 确定我所有的照片都在头等舱
- r - 跨年使用 data.table 扩展行
- javascript - Parse.com JS destroy() 未更新
- php - ubuntu 20.04 apache2 - php 文件下载
- excel - 如何过滤掉数字和 . 在 excel 中使用 Excel 公式从文本
- javascript - setInterval 函数未使用 JavaScript ES6 运行
- android - 在editText单击上打开表情符号键盘布局
- excel-formula - 多元线性回归模型中的自变量
- python - Python多处理 - 池