ymfhack
- ymfhack 回答了问题 yii2 导出pdf
use kartik\mpdf\Pdf; public function actionReport() { // get your HTML raw content without any layouts or scripts $content = $this->renderPartial('_reportView'); // setup kartik\mpdf\Pdf component $pdf = new Pdf([ // set to use core fonts only 'mode' => Pdf::MODE_CORE, // A4 paper format 'format' => Pdf::FORMAT_A4, // portrait orientation 'orientation' => Pdf::ORIENT_PORTRAIT, // stream to browser inline 'destination' => Pdf::DEST_BROWSER, // your html content input 'content' => $content, // format content from your own css file if needed or use the // enhanced bootstrap css built by Krajee for mPDF formatting 'cssFile' => '@vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.min.css', // any css to be embedded if required 'cssInline' => '.kv-heading-1{font-size:18px}', // set mPDF properties on the fly 'options' => ['title' => 'Krajee Report Title'], // call mPDF methods on the fly 'methods' => [ 'SetHeader'=>['Krajee Report Header'], 'SetFooter'=>['{PAGENO}'], ] ]); // return the pdf output as per the destination setting return $pdf->render(); }
有啥特别的吗
- ymfhack 回复了话题 YII2 自定义导入导出Excel
还少个定义格式的方法,就完美了
- ymfhack 回答了问题 gii生成代码访问提示404错误
可以 但是供访问的最好是在 再多目录 你就要配置了
- ymfhack 回答了问题 gii生成代码访问提示404错误
message/message/index 你感觉这个访问的应该是哪 你controller的目录 深了
- ymfhack 回答了问题 原生 SQL 语句转换成 Yii2 查询
你如果安全过滤的话 就应该在
get
就转int if(!is_numeric($page) || !is_numeric($pageSize))
这俩参数就会变成正常0
或者无就是默认值就是了model::find()
返回的是数据库链接对象 链式返回的都是 @mydzoo Yii应该也是可以用缓存的 但是你看目前Yii模板的解析方式和其他的两种的缓存的方式 就插一个找layout的地方阿
- ymfhack 回答了问题 RESTFull 错误要怎么返回json
/** * @return bool whether this response is successful */ public function getIsSuccessful() { return $this->getStatusCode() >= 200 && $this->getStatusCode() < 300; }
- ymfhack 2017-06-26 已签到连续签到1天,获得了5个金钱