phantomjs 自定义 header 问题请教

我在外部变量 title = "标题"

            var title ="标题"
            var config = {
                width: "1040px",
                height: "1414px",
                borderLeft: "5px solid #000",
                margin: {
                    top: "0px",
                    left: "15px",
                    right: "5px",
                    bottom: "0px"
                },
                orientation: "portrait",
                header: {
                    height: 315,
                    contents: phInstance.callback(function(page, num) {
                    //这里的 title 获取不到 
                    return title;
                })
                },
                footer: {
                    height: 50,
                    contents: phInstance.callback(function(pageNum, numPages) {
                        return "<div style='border-top:8px dashed #000'></div><p style='text-align:center;'>底部" + pageNum + "/" + numPages + "</p>";
                    })
                }
            }

报错信息

info: undefined:1 in render
info: phantomjs://code/shim.js:191 in executeCommand
info: phantomjs://code/shim.js:141 in read
info: SyntaxError: Unexpected EOF

请教下使用过的朋友 我这块怎么去设置自定义标题

查看回复