我一直在努力处理页眉和页脚数据已经有一段时间了,并且认为是时候在论坛上问这个了.
我要做的是决定是否添加页眉/页脚是否应该添加页眉/页脚.所以代码方面我想在添加页面时将页眉/页脚设置为打开或关闭.
我试图通过设置一个额外的参数$ setFooterHeader来操作AddPage函数,默认设置为true.每当我执行addPage('','',false)时,尝试将此参数设置为false; 但由于某种原因它忽略了它,我无法弄清楚为什么.
如果我在函数本身中将参数的默认值设置为false,它就像一个魅力,但当我尝试在我的脚本中执行它并将其设置为参数时,它完全忽略它.
这是fpdf.php文件的代码片段(函数addPage)
function AddPage($orientation='', $size='', $setHeaderFooter=true)
{
// Start a new page
if($this->state==0)
$this->Open();
$family = $this->FontFamily;
$style = $this->FontStyle.($this->underline ? 'U' : '');
$fontsize = $this->FontSizePt;
$lw = $this->LineWidth;
$dc = $this->DrawColor;
$fc = $this->FillColor;
$tc = $this->TextColor;
$cf = $this->ColorFlag;
if($this->page>0)
{
// Page footer
if ($setHeaderFooter == true)
{
$this->InFooter = true;
$this->Footer();
$this->InFooter = false;
// Close page
$this->_endpage();
}
}
// Start new page
$this->_beginpage($orientation,$size,$setHeaderFooter);
// Set line cap style …Run Code Online (Sandbox Code Playgroud) 我试图弄清楚如何使用 Axios 和 Nestjs 框架发出 http 请求。在 Nest 文档中,它提供了该过程的高级概述,但没有详细介绍如何处理使用 axios 发出请求时返回的 Observable。
我正在使用相互 SSL 身份验证向 API 发出请求。我遇到了证书问题,请求失败,但没有引发异常,控制器返回 200 ok,没有数据。当我注释掉所有 rxjs 代码并执行 axios.get(...).toPromise() 时,我发现了这一点。当我这样做时,我突然有了完整的堆栈跟踪并引发了异常。
知道我在这里做错了什么吗?我应该将 catchError 块放在 map 块之前吗?
我的代码:
getRegistrationStatus(msisdn: string): Observable<AxiosResponse> {
return this.httpService.get(`${this.API_BASE_URL}/vb/registrationStatus?MSISDN=${msisdn}`)
.pipe(
map(res => res.data),
catchError(e => {
throw new HttpException(e.statusText, e.status);
})
);
}
Run Code Online (Sandbox Code Playgroud)
我的 HTTP 模块/axios 配置:
HttpModule.register({
timeout: 20000,
validateStatus: () => true,
httpsAgent: new Agent({
ca: readFileSync(process.env.va_ca),
keepAlive: false,
cert: readFileSync(process.env.va_cert),
key: readFileSync(process.env.va_key),
passphrase: process.env.va_passphrase
})
})
Run Code Online (Sandbox Code Playgroud)