搜尋
首頁後端開發php教程functionincphp超越php


/**
 * 全域函數
 *
 * @author   Avenger 
 * @version 1.14 $Id 2003-10:30 */
/**
 * 彈出提示框
 *
 * @access public
 * @param string $txt 彈出一個提示框,$txt容易*/
函數popbox($txt) {
    echo "";
}
/**
 * 非法操作警告
 *
 * @access public
 * @param string $C_alert   則不回傳
 * @return void
 */
函數alert($C_alert,$I_goback='main.php') {
if(!empty($I_goback)) {
echo "<script>alert('$C_alert');window.location.href='$I_goback';</script>";
    } else {
        echo "<script>alert('$C_alert');</script>";
    }
}
/

*/str. ) {
    $chars='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-@#~'; // 用來從    $password='';
    while(strlen($password)      )),1);
    回傳$密碼;
}
/**
 * 產生隨機字串
 *
 * 產生一個指定長度的隨機字串,並傳回給使用者
 *
 * @access  🎜> *
 * @access  🎜> *
 * @access  🎜> *
 * @access  🎜> 字串的位數
 * @return string 
 */
function ckselect($str1,$str2)$ ==🎜>   $str2) {
        return ' 已選擇';
    }
    返回 '';     $ftpid=@ftp_connect( $ftp_server,$ftp_port) 或die('連接到Ftp 伺服器錯誤! ');
    @ftp_login($ftpid,$ftp_username,$ftp_password) 或die('登入Ftp 錯誤!');
    @ftp_chdir($ftpid,'/'.$ftpid.錯誤! ');
    回傳$ftpid;
}
/**
 * 截取中文部分字串
 *
 * 截斷指定字串指定長度的函數,此函數可自動判定中英文,不會出現亂碼
 *
 * @access public
 * @param string    $str    要處理中的字串
 * @param int       預設會加上
 * @return string
 */
函數 showtitle($str,$strlen=10,$other=true) {
    $j = 0;
    for($i=0;$i      if(ord(substr($str,$i,1))>0xa0) $j++;
    if($j%2!=0) $strlen++;
    $rstr=substr($str,0,$strlen);
    if (strlen($str)>$strlen && $other) {$rstr.='...';}
    return $rstr;
}
/**
 * 製作連結
 *
 * @access public
 * @param string    url      顯示的連結文字
 * @param string    target目標架構
 * @param string    extras      擴充參數
 * @return string
 */
函數 make_link ($url, $linktext=false, $target=false, $extras=false) {
    return sprintf("%s",
        $url,
        ($mtarget ? >        ($extras ? ' '.$extras : ''),
        ($linktext ? 
}
/**
 * 格式化使用者評論
 *
 * @access public
 * @param string
 * @return void
 */
函數 clean_note($text) {
    $text = htmlspecialchars(trim($text));
    /* 將網址轉為連結*/
    $text = preg_replace("/((mailto|http|ftp|nntp|news):.+?)(>|s|)|"|.s |$)/","13",$text);
    /*這個「修復」程式碼最終會消失。*/
    $修復= array ('
','

','

');
    重置($fixes)
    while (list(,$f) = each( $fixes)) {
        $text = htmlspecialchars($f), $f, $text);
        $text }
    / * 

 標籤看起來非常奇怪(破壞了
       標籤)。

'), '
', $text);
    /* 刪除

 標籤以防止它不會出現在註解中*/
    $text = str_replace (>    $text = str_replace ( array.', ''), '', $text);
    /* 保留換行符號*/
    $text = str_replace("n", "
", $text> );
    /* 這只是斷長行 */
    if (function_exists("wordwrap")) {
   
    //保留使用者註釋的間距
    $text = str_replace("  ", "  ", $text);
   ", "  ", $text);
   ", "  ", $text);
  
函數getimageinfo($img) {
    $img_info = getimagesize($img);
    switch ($img_info[2]))     休息;
    情況2:
    $imgtype = 「JPG」;
     >    休息;
}
    $img_size = ceil(filesize($img)/1000)."k";
    $new_img_info = 陣列        "height" =>$img_info[1],
        "type"=>$imgtype,
        "size"=>$img_size /* *
 * 取得圖象資訊的函數
 *
 * 一個全面取得圖象資訊的函數
 *
 * @access public  *
 * @access public > * @return array
 */
函數getmicrotime() {
    $tmp = explode(' ', microtime());
    返回(真實)$tmp[1]。 substr($tmp[0], 1);
}
/**
 * 計算目前時間
 *
 * 以微秒為單位返回目前系統的時間
 *
 * @access public
 *
 * @access public
 *
 * @access public
 **/
函數wfile($file,$content,$mode='w') {
    $ oldmask = umask(0);
    $fp = fopen($file, $mode);
    if (!$fp) 回復($fp);
    umask($oldmask);
    回傳true;
}
/**
 * 寫文件操作
 *
 * @access public
 * @param bool
 * @return void
 */
function tpl_load($t. templates/',$empty='remove') {
    全域 $tpl;
    $路徑? '' : $path='./templates/'; 
    require_once 'HTML/Template/PHPLIB.php';
    $ setFile('main',$tplfile);
}
/**
 * 載入範本檔案
 *
 * @access public
 * @return void
 */
函數tpl_output() {
    全域$tpl  $. output','main');
    $tpl->p('輸出');
}
/**
 * 邮件发送函数
 *
 * @access public private
 * @param bool
 * @return void
 */
function mailSender($from, $to, $title, $content) {
    $from ? $from = 'sender@phpe.net' : '';
    $title ? $title = 'From Exceed PHP...' : '';
    $sig = "
      感谢您使用我们的服务.\n\n
                                                Exceed PHP(超越PHP)\n
                                                $maildate\n\n
---------------------------------------------------------------------------------------
\n\n
去发现极限方法的唯一办法就是去超越它\n
超越PHP欢迎您(http://www.phpe.net)\n
";
    $content .= $sig;
    if (@mail($to, $title, $content, "From:$from\nReply-To:$from")) {
        return true;
    } else {
        return false;
    }
}
function br2none($str) {
    return str_replace(array('
', '
'), "", $str);
}
/**
 * UBB解析
 *
 * @param      none
 * @access     public
 * @return     void
*/
function ubbParse($txt, $coverhtml=0) {
    if ($coverhtml == 0) $txt = nl2br(new_htmlspecialchars($txt));  //BR和HTML转换
    //只转换BR,不转换HTML
    if ($coverhtml == 1) {
        if (!preg_match('//is', $txt) && !preg_match('//is', $txt)) {
            $txt = strip_tags($txt);
            $txt = nl2br($txt);
        } else {
            $txt = str_replace('', '', $txt);
        }
    }
    // pre and quote
    //error_reporting(E_ALL);
    $txt = preg_replace( "#\[quote\](.+?)\[/quote\]#is", "
\1
", $txt );
    $txt = preg_replace( "#\[code\](.+?)\[/code\]#ise", "'
'.br2none('').'
'", $txt );
    // Colors 支持篏套
    while( preg_match( "#\[color=([^\]]+)\](.+?)\[/color\]#is", $txt ) ) {
        $txt = preg_replace( "#\[color=([^\]]+)\](.+?)\[/color\]#is", "\2", $txt );
    }
    // Align
    $txt = preg_replace( "#\[center\](.+?)\[/center\]#is", "
\1
", $txt );
    $txt = preg_replace( "#\[left\](.+?)\[/left\]#is", "
\1
", $txt );
    $txt = preg_replace( "#\[right\](.+?)\[/right\]#is", "
\1
", $txt );
    // Sub 與 sup
    $txt = preg_replace( "#[sup](.+?)[/sup]#is", ", $txt);
    $txt = preg_replace("#[sub](.+?)[/sub]#is", "1", $txt );
// 電子郵件標籤
    // [email]avenger@php.net[/email]   [email=avenger@php.net]寄電子郵件給我[/email]
   [email] ](S+?)[/email]#i"                                     , "1", $txt );   $txt = preg_replace(「#[電子郵件* = s*"([.w-]+@[.w-]+.[.w-]+)s*"s*](.*?)[/email]#i"  , "2", $txt);
    $txt = preg_replace( "#[emails*=s*([.w-]+@[.w-]+. [w- ]+)s*](.*?)[/email]#i"                       , "    // [url]http://www.phpe.net[/url]   [url=http://www.phpe.net]超越PHP! [/url]
    $txt = preg_replace( "# url](S+?)[/url]#i"                            $txt );
    $txt = preg_replace( "#[ urls*=s*"s*(S+?)s*"s*](.*?)[/url]#i" , "
2 ", $txt ); ref='1' target='_blank' >2", $txt);
    // 從簡單的東西開始
    $txt = preg_replace("#[b](.+?)[/b]# is", "1", $ TXT );
    $txt = preg_replace(“#[i](.+?)[/i]#is”, 「1”, $txt );
    $txt = preg_replace(“#[u](.+?)[/u]#is”, 「1」, $txt );
    $txt = preg_replace(“#[s](.+?)[/s]#is”, 「1」, $txt );
    // 標頭文字$    // 標頭文字$    // 標頭文字
    $txt = preg_replace( "#[h([1-6])](.+?)[/h[1-6]]#is", "

; 2

", $ txt);
    // 圖像
    $txt = preg_replace( "#[img](.+?)[/img]#i", $txt     $sec - $date;
    //秒1 天 為 86400
    if ($sec      ' 小時前';
    } elseif ($秒         elseif ($sec         return round($sec/(86400*7)).  return round($secks]        return date('Y-m- d', $date);
    }
}
?>
以上就介紹了 functionincphp超越php,包括了方面的內容,希望對PHP教程有興趣的朋友有所幫助。

陳述
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
高流量網站的PHP性能調整高流量網站的PHP性能調整May 14, 2025 am 12:13 AM

TheSecretTokeEpingAphp-PowerEdwebSiterUnningSmoothlyShyunderHeavyLoadInVolvOLVOLVOLDEVERSALKEYSTRATICES:1)emplactopCodeCachingWithOpcachingWithOpCacheToreCescriptexecution Time,2)使用atabasequercachingCachingCachingWithRedataBasEndataBaseLeSendataBaseLoad,3)

PHP中的依賴注入:初學者的代碼示例PHP中的依賴注入:初學者的代碼示例May 14, 2025 am 12:08 AM

你應該關心DependencyInjection(DI),因為它能讓你的代碼更清晰、更易維護。 1)DI通過解耦類,使其更模塊化,2)提高了測試的便捷性和代碼的靈活性,3)使用DI容器可以管理複雜的依賴關係,但要注意性能影響和循環依賴問題,4)最佳實踐是依賴於抽象接口,實現鬆散耦合。

PHP性能:是否可以優化應用程序?PHP性能:是否可以優化應用程序?May 14, 2025 am 12:04 AM

是的,優化papplicationispossibleandessential.1)empartcachingingcachingusedapcutorediucedsatabaseload.2)優化的atabaseswithexing,高效Quereteries,and ConconnectionPooling.3)EnhanceCodeWithBuilt-unctions,避免使用,避免使用ingglobalalairaiables,並避免使用

PHP性能優化:最終指南PHP性能優化:最終指南May 14, 2025 am 12:02 AM

theKeyStrategiestosigantificallyBoostPhpaPplicationPerformenCeare:1)UseOpCodeCachingLikeLikeLikeLikeLikeCacheToreDuceExecutiontime,2)優化AtabaseInteractionswithPreparedStateTementStatementStatementAndProperIndexing,3)配置

PHP依賴注入容器:快速啟動PHP依賴注入容器:快速啟動May 13, 2025 am 12:11 AM

aphpdepentioncontiveContainerIsatoolThatManagesClassDeptions,增強codemodocultion,可驗證性和Maintainability.itactsasaceCentralHubForeatingingIndections,因此reducingTightCightTightCoupOulplingIndeSingantInting。

PHP中的依賴注入與服務定位器PHP中的依賴注入與服務定位器May 13, 2025 am 12:10 AM

選擇DependencyInjection(DI)用於大型應用,ServiceLocator適合小型項目或原型。 1)DI通過構造函數注入依賴,提高代碼的測試性和模塊化。 2)ServiceLocator通過中心註冊獲取服務,方便但可能導致代碼耦合度增加。

PHP性能優化策略。PHP性能優化策略。May 13, 2025 am 12:06 AM

phpapplicationscanbeoptimizedForsPeedAndeffificeby:1)啟用cacheInphp.ini,2)使用preparedStatatementSwithPdoforDatabasequesies,3)3)替換loopswitharray_filtaray_filteraray_maparray_mapfordataprocrocessing,4)conformentnginxasaseproxy,5)

PHP電子郵件驗證:確保正確發送電子郵件PHP電子郵件驗證:確保正確發送電子郵件May 13, 2025 am 12:06 AM

phpemailvalidation invoLvesthreesteps:1)格式化進行regulareXpressecthemailFormat; 2)dnsvalidationtoshethedomainhasavalidmxrecord; 3)

See all articles

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

Video Face Swap

Video Face Swap

使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境

VSCode Windows 64位元 下載

VSCode Windows 64位元 下載

微軟推出的免費、功能強大的一款IDE編輯器

PhpStorm Mac 版本

PhpStorm Mac 版本

最新(2018.2.1 )專業的PHP整合開發工具

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

將Eclipse與SAP NetWeaver應用伺服器整合。

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser是一個安全的瀏覽器環境,安全地進行線上考試。該軟體將任何電腦變成一個安全的工作站。它控制對任何實用工具的訪問,並防止學生使用未經授權的資源。