$log = new \yii\log\FileTarget();
$content=var_export($menu,"true");//将数组或对象转换字符串格式 $content 数组变量
$log->logFile = dirname(dirname(__DIR__)) . "/" . date('y-m-d') . ".log"; //日志保存路径
$log->messages[] = ['' . "\r\n", 4, $content, microtime(true)]; //$content 日志打印内容
$log->export();