当前位置: 首页>>代码示例>>PHP>>正文


PHP f::import方法代码示例

本文整理汇总了PHP中f::import方法的典型用法代码示例。如果您正苦于以下问题:PHP f::import方法的具体用法?PHP f::import怎么用?PHP f::import使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在f的用法示例。


在下文中一共展示了f::import方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: imagecreatetruecolor

<?php

require_once './core/helper/f.php';
f::import('core/helper/Cifrar.php');
$random1 = Cifrar::random(4, 'int');
$random2 = Cifrar::random(4, 'int');
$texto = $random1 . ' ' . $random2;
$width = 149;
$height = 27;
$image = imagecreatetruecolor($width, $height);
$font = f::getPatchApp() . '/resource/plugin/reCaptcha/fonts/Courier.ttf';
$black = imagecolorallocate($image, 0, 0, 0);
// color negro
$white = imagecolorallocate($image, 255, 255, 255);
// background color blanco
//$black=$white;
imagefilledrectangle($image, 0, 0, $width, $height, $white);
$lineas = mt_rand(10, 15);
for ($i = 0; $i < $lineas; $i++) {
    $max = mt_rand(80, 100);
    $r = mt_rand(100, 200);
    $g = mt_rand(100, 200);
    $b = mt_rand(100, 200);
    $linescolor = imagecolorallocatealpha($image, $r, $g, $b, $max);
    $x1 = mt_rand(0, $width);
    $y1 = mt_rand(0, $height);
    $x2 = mt_rand(0, $width);
    $y2 = mt_rand(0, $height);
    imageline($image, $x1, $y1, $x2, $y2, $linescolor);
}
$aumentar = 16;
开发者ID:eddyn73,项目名称:SURP,代码行数:31,代码来源:captcha.php

示例2: dompdf

    protected function dompdf($titulo, $html, $modo = 'online')
    {
        $htmlpdf = '
        <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
        <html xmlns="http://www.w3.org/1999/xhtml">
            <head>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
            <title>' . $titulo . '</title>
             
            <style>
            body
            {
                font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;
                font-size:12px;
                font-weight:10;
            }
            div.SiguientePagina 
            {
                page-break-after: always;
            }
            </style>
            </head>

            <body>
            <script type="text/php">
            if ( isset($pdf) ) 
            {
              $font = Font_Metrics::get_font("Trebuchet MS");;
              $size = 10;
              $color = array(0,0,0);
              $text_height = Font_Metrics::get_font_height($font, $size);

              $foot = $pdf->open_object();

              $w = $pdf->get_width();
              $h = $pdf->get_height();

              // Draw a line along the bottom
              $y = $h - $text_height - 24;
              $pdf->line(16, $y, $w - 16, $y, $color, 0.5);

              $pdf->close_object();
              $pdf->add_object($foot, "all");

              $text = "Pagina {PAGE_NUM} de {PAGE_COUNT}";  

              // Center the text
              $width = Font_Metrics::get_text_width("Pagina 1 de 2", $font, $size);
              $pdf->page_text($w / 2 - $width / 2, $y, $text, $font, $size, $color);
            }
            </script>
            ' . $html . '
            </body>
        </html>
        ';
        //return $htmlpdf;
        f::import('resource/plugin/dompdf/dompdf_config.inc.php');
        $oDOMPDF = new DOMPDF();
        $oDOMPDF->load_html($htmlpdf);
        //$dompdf->load_html_file('archivos/complementos/dompdf/www/index.php');
        $oDOMPDF->render();
        switch ($modo) {
            case 'download':
                $modo = array("Attachment" => 1);
                break;
            default:
                $modo = array("Attachment" => 0);
                break;
        }
        $oDOMPDF->stream($titulo . ".pdf", $modo);
    }
开发者ID:eddyn73,项目名称:SURP,代码行数:71,代码来源:BL.php


注:本文中的f::import方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。