検索
ホームページバックエンド開発PHPチュートリアルDolrPHP テンプレート エンジン DolrViews 共有

【分享】DolrPHPモジュール板引擎DolrViews分享
核心文件:DolrViews.class.php:

  1. /**
  2. * DolrPHP テンプレート エンジン
  3. * @author Joychao
  4. * @version 1.0 beta
  5. * @license http: //www.Joychao.cc
  6. */
  7. define('DOLRVIEWS') または define('DOLRVIEWS',true);
  8. define ('DIR_SEP') またはdefine('DIR_SEP',DIRECTORY_SEPARATOR);
  9. class DolrViews
  10. {
  11. /**
  12. * シングルトン オブジェクト
  13. *
  14. * @static var
  15. * @var オブジェクト DolrViews
  16. */
  17. protected static $_instance;
  18. /**
  19. * テンプレート変数
  20. *
  21. * @var array
  22. */
  23. protected $_tpl_vars=array();
  24. /**
  25. * テンプレートパラメータ情報
  26. *
  27. * @var array
  28. */
  29. protected $_options=array(
  30. 'template_dir'=>'テンプレート',
  31. 'compile_dir'=>' templates_c',
  32. 'cache_dir'=>'cache',
  33. 'caching'=>false,
  34. 'cache_lifetime'=>3600,
  35. 'plugins_dir'=>'plugins',
  36. 'tpl_suffix'=>'html',
  37. 'php_handing'=>false,
  38. ) ;
  39. /**
  40. * 含まれるプラグイン
  41. * @var array
  42. */
  43. protected $includePlugins=array();
  44. /**
  45. * メインテンプレートを含まないテンプレート
  46. * @var string
  47. */
  48. protected $mainTplFileName;
  49. /**
  50. * シングルトンモード呼び出しメソッド
  51. *
  52. * @static
  53. * @return object DolrViews
  54. */
  55. public static function getInstance($options=array) ()) {
  56. if (!self :: $_instance instanceof self)
  57. self :: $_instance = new self($options);
  58. return self :: $_instance;
  59. }
  60. /**
  61. * コンストラクター、すべての構成を初期化します
  62. *
  63. * @param array $config=array(); 構成配列
  64. * @example:
  65. * $_options=array(
  66. * 'template_dir'=>'テンプレート',
  67. * 'compile_dir'=>'templates_c',
  68. * 'cache_dir'=>'cache',
  69. * 'caching'=>false,
  70. * 'cache_lifetime'=>3600,
  71. * ' plugins_dir '=>'プラグイン',
  72. * 'php_handing'=>false,
  73. * );
  74. * $tpl=new DolrViews($_options); 🎜>
  75. */
  76. パブリック関数 __construct($options=array())
  77. {
  78. if (!empty($options))
  79. {
  80. $this->setOptions($options);
  81. }
  82. }
  83. /**
  84. * 変数をテンプレートに割り当てます
  85. *
  86. * @param string $varName 変数名
  87. * @parammixed $varValue 変数値
  88. */
  89. public function assign($varName,$varValue)
  90. {
  91. $this->tpl_vars[$varName]=&$varValue;
  92. }
  93. /**
  94. * ページへの出力を表示
  95. *
  96. * @param string $tplFileName テンプレート ファイル名
  97. */
  98. public function display($tplFileName,$cacheId=null)
  99. {
  100. $cacheId=is_null($cacheId)?$_SERVER['REQUEST_URI']:$cacheId;
  101. $this->mainTplFileName=$tplFileName;
  102. $tplFilePath=$this->_getTplPath($tplFileName);
  103. extract($this->_tpl_vars) ;
  104. //内置变量
  105. extract($this->gt;_getSystemVars($tplFileName));//系统变量
  106. //存在するかどうか
  107. if($this->_options['caching']){
  108. if($this->isCached($tplFileName,$cacheId)){
  109. include $this-> ;_getCacheFile($tplFileName,$cacheId);
  110. }else{///否か保存文書
  111. include $this->_writeCache($tplFileName,$this->_parseTpl($tplFileName) ,$cacheId),$cacheId);// 写入缓存
  112. }
  113. }else{//非缓存モード
  114. include $this->_parseTpl($ tplFileName,$cacheId);//解析写入编译文件并包含
  115. }
  116. }
  117. /**
  118. * 構成テンプレート オプション
  119. *
  120. * @param array $options 構成配列
  121. */
  122. public function setOptions($options)
  123. {
  124. foreach ($options as $optionName => $optionValue) {
  125. $this->set($optionName,$optionValue);
  126. }
  127. }
  128. /**
  129. * オプションの設定
  130. *
  131. * @param string $optionName オプション名
  132. * @parammixed $optionValue オプション値
  133. */
  134. パブリック関数 __set($optionName,$optionValue)
  135. {
  136. $this->set($optionName,$optionValue) ;
  137. }
  138. /**
  139. * 構成を個別に設定します
  140. *
  141. * @param string $optionName オプション名
  142. * @parammixed $optionValue オプション値
  143. */
  144. public function set($optionName,$optionValue)
  145. {
  146. switch (strto lower($optionName)) {
  147. case 'template_dir':
  148. $optionValue=$this->trimPath($optionValue).DIR_SEP;
  149. if(! file_exists($optionValue))
  150. $this->_throwException('指定されたテンプレート ディレクトリ "'.$optionValue.'" が見つかりませんでした);
  151. $this->_options [ 'template_dir']=$optionValue;
  152. break;
  153. case 'compile_dir':
  154. $optionValue=$this->_trimPath($optionValue).DIR_SEP;
  155. if(!file_exists($optionValue))
  156. $this->_throwException('指定されたコンパイル ディレクトリ "'.$optionValue.'"' が見つかりませんでした);
  157. $this->_options['compile_dir']=$optionValue;
  158. break;
  159. case 'cache_dir':
  160. $optionValue=$this-> ;_trimPath ($optionValue).DIR_SEP;
  161. if(!file_exists($optionValue))
  162. $this->_throwException('指定されたキャッシュ ディレクトリ "'.$optionValue.'"見つかりませんでした ');
  163. $this->_options['cache_dir']=$optionValue;
  164. break;
  165. case 'plugins_dir':
  166. $ optionValue=$this->trimPath($optionValue).DIR_SEP;
  167. if(!file_exists($optionValue))
  168. $this->_throwException('指定されたキャッシュディレクトリが見つかりませんでした "'.$optionValue.'"');
  169. $this->_options['plugins_dir']=$optionValue;
  170. break;
  171. case 'キャッシュ' :
  172. $this->_options['caching']=(boolean)$optionValue;
  173. break;
  174. case 'cache_lifetime':
  175. $this->_options['cache_lifetime']=(float)$optionValue;
  176. break;
  177. case 'php_handing':
  178. $this- >_options[ 'php_handing']=(boolean)$optionValue;
  179. break;
  180. case 'tpl_suffix':
  181. $this->_options['tpl_suffix' ]=trim( $optionValue);
  182. break;
  183. default:
  184. $this -> _throwException("不明なテンプレート構成オプション "$optionName"");
  185. }
  186. }
  187. /**
  188. * テンプレート キャッシュをクリアします
  189. *
  190. * @param string $tplFileName='' テンプレート ファイル名。渡されない場合、すべてのキャッシュが削除されます
  191. * @return ブール値の成功または失敗
  192. */
  193. public function clearCache($ tplFileName=' ',$cacheId=null)
  194. {
  195. $cacheId=is_null($cacheId)?$_SERVER['REQUEST_URI']:$cacheId;
  196. if (!empty ($tplFileName)){
  197. $cacheFile=$this->getCacheFile($tplFileName,$cacheId);
  198. if(file_exists($cacheFile)){
  199. chmod($cacheFile, 0777);
  200. @unlink($cacheFile);
  201. }
  202. }else{//すべてのキャッシュ ファイルを削除します
  203. foreach (glob($this->_options['cache_dir'].'*') as $cacheFile) {
  204. chmod($cacheFile, 0777);
  205. @unlink( $cacheFile) ;
  206. }
  207. }
  208. }
  209. /**
  210. * 指定されたテンプレート ファイルがキャッシュされているかどうかを確認します
  211. *
  212. * @param string $tplFileName テンプレート ファイル名
  213. * @return boolean
  214. */
  215. パブリック関数 isCached( $tplFileName,$cacheId=null)
  216. {
  217. $tplFilePath=$this->_getTplPath($tplFileName);
  218. $cacheId=is_null ($cacheId )?$_SERVER['REQUEST_URI']:$cacheId;
  219. $cacheFile=$this->_getCacheFile($tplFileName,$cacheId);
  220. if(file_exists($ cacheFile) / /
  221. と filemtime($cacheFile)+$this->_options['cache_lifetime']>time()//期限切れではありません
  222. と filemtime($cacheFile) >filemtime ($tplFilePath) //テンプレートは変更されていません
  223. ){//存在しており、期限切れになっていません
  224. return true;
  225. }else{
  226. return false;
  227. }
  228. }
  229. /**
  230. * 組み込み変数の取得
  231. * @return array
  232. */
  233. 保護された関数_getSystemVars($tplFileName){
  234. //組み込み変数
  235. $_sysVars=array();
  236. $_sysVars['dolr_now']=time();
  237. $_sysVars['dolr_get ']=$_GET;
  238. $_sysVars['dolr_post']=$_POST;
  239. $_sysVars['dolr_request']=$_REQUEST;
  240. $_sysVars[' dolr_cookie']=isset($_COOKIE)?$_COOKIE:null;
  241. $_sysVars['dolr_session']=isset($_SESSION)?$_SESSION:null;
  242. $_sysVars[' dolr_template']=basename($tplFileName);
  243. $const=get_dependent_constants(true);
  244. $_sysVars['dolr_const']=$const ['user'];
  245. $_sysVars['dolr_url']="http://".$_SERVER ['HTTP_HOST'].$_SERVER['PHP_SELF'];
  246. if (!empty($_SERVER['QUERY_STRING' ])){
  247. $_sysVars['dolr_url'].='?'.$_SERVER['QUERY_STRING'];
  248. }
  249. return $_sysVars;
  250. }
  251. /**
  252. * テンプレート ファイルのパスを取得します
  253. *
  254. * @param string $tplFileName template file
  255. * @return string ファイル名
  256. */
  257. 保護された関数 _getTplPath($tplFileName)
  258. {
  259. return $this->_options['template_dir'].$this->_trimPath($tplFileName);
  260. }
  261. /**
  262. * キャッシュされたファイルを取得します
  263. * @param string $tplFileName template file
  264. * @return string ファイル名
  265. */
  266. 保護された関数 _getCacheFile($tplFileName, $cacheId)
  267. {
  268. return $this->_options['cache_dir'].$tplFileName.'.cache.'.md5($cacheId).'.php';
  269. }
  270. /**
  271. * コンパイル済みファイル名を取得します
  272. *
  273. * @param string $tplFileName template file
  274. * @return string ファイル名
  275. */
  276. 保護された関数 _getCompileFile( $tplFileName, $cacheId)
  277. {
  278. return $this->_options['compile_dir'] .$tplFileName.'.compile.php';
  279. }
  280. /**
  281. * 解析されたテンプレート
  282. *
  283. * @param string $tplFileName テンプレート ファイル
  284. * @return string 解析されたコンテンツ
  285. */
  286. 保護された関数 _parseTpl($tplFileName ,$cacheId)
  287. {
  288. $tplFilePath=$this->gt;_getTplPath($tplFileName);
  289. if (!file_exists($tplFilePath) または !is_readable($ tplFilePath)) {
  290. $this->_throwException(' 指定されたモール板文件を打てません'.$tplFileName.'"');
  291. }
  292. $content =file_get_contents($tplFilePath);
  293. //检测包含、检测所有的 include 'xxx.html'
  294. preg_match_all('/[nrt]*[nrt]*/s', $content, $matches);
  295. if(!empty($matches[1])){
  296. foreach ($matches[1] as $key=>$fileName) {
  297. $includeFilePath=$this-> _getTplPath($fileName);
  298. if (!file_exists($includeFilePath) または !is_readable($includeFilePath)) {
  299. $this->_throwException(' 指定されたモジュールファイルを打てません" '.$includeFilePath.'"');
  300. }
  301. $includeCompilePath=$this->_getCompileFile($fileName,$cacheId);// 编译文件名
  302. $this->_parseTpl($fileName,$cacheId);
  303. $content=str_replace($matches[0][$key], '', $content);
  304. }
  305. }
  306. //规则
  307. $pattern=array(
  308. '/ ?>[nr]* /s',//删除 PHP 代打断间多余空格及换行
  309. '/(]+)s*>)/es',// 直接出变量内容
  310. '//s',//包含模板
  311. '/(.+?)/ies',//if /if
  312. '//ies',//elseif
  313. '//is',//else
  314. '/(.+?)(.+?)/ies',//loop $array $v
  315. '/(.+?)/ies',//loop $array $v
  316. '/(.+?)(.+?)/ies',//loop $array $k $v loopelse
  317. '/(.+?)/ies',//loop $array $k $v
  318. '//',//
  319. );
  320. // PHP 格式
  321. $php=array(
  322. ' ',
  323. "$this->_parseVar('\1')",
  324. ' _options['template_dir']."\1';?>",
  325. "$this->_stripvtags('','\2');",
  326. "$this->_stripvtags('','');",
  327. '',
  328. "$this->_stripvtags('','\3\4');",
  329. "$this->_stripvtags('','\ 3n');",
  330. "$this->_stripvtags(' \3) { ?>','\4\ 5');",
  331. "$this->_stripvtags(' \3) { ?>','\4');",
  332. "",
  333. );
  334. $content=preg_replace($pattern, $php, $content);
  335. //プラグインを含める
  336. $pluginsString='';
  337. if($tplFileName==$this->mainTplFileName){// メイン テンプレートの場合は、インクルード ファイル
  338. foreach ($this->includePlugins as $plugin) {
  339. $pluginsString.="include $this->options['plugins_dir'].'{$plugin }';n ";
  340. }
  341. }
  342. $header=
  343. /* *
  344. * {$tplFileName}
  345. * DolrViews テンプレート コンパイル ファイル
  346. * @package {$this->mainTplFileName}
  347. */
  348. define('DOLRVIEWS') または exit('アクセス拒否');
  349. $pluginsString
  350. ?>n
  351. DOLRVIEWS;
  352. $content=$header.$content;
  353. $compileFilePath=$this->_writeCompile($tplFileName,$content,$cacheId);//コンパイルされたファイルを書き込みます
  354. return $compileFilePath;
  355. }
  356. /**
  357. * キャッシュテンプレートファイル
  358. *
  359. * @param string $tplFileName テンプレートファイル
  360. * @param string $cacheId キャッシュ ID
  361. */
  362. 保護関数 _writeCache ($tplFileName, $cacheId)
  363. {
  364. $tplFilePath=$this->_getTplPath($tplFileName);
  365. $cacheFilePath=$this->_getCacheFile( $tplFileName,$cacheId);//ファイル名を保存
  366. $compileFilePath=$this->_getCompileFile($tplFileName,$cacheId);
  367. ini_set('error_reporting','off' );// エラー プロンプトをキャッシュしません
  368. extract($this->_tpl_vars);//テンプレート変数
  369. extract($this->_getSystemVars($tplFileName));/ /システム変数
  370. ob_start();
  371. if(file_exists($compileFilePath) and filemtime($compileFilePath)>filemtime($tplFilePath))//テンプレートは変更されていません
  372. {
  373. include $compileFilePath;
  374. }else{
  375. include $this->parseTpl($tplFileName,$cacheId);//解析して書き込みますコンパイルされたファイル
  376. }
  377. $html=ob_get_contents();
  378. ob_clean();
  379. file_put_contents($cacheFilePath, $html);
  380. return $cacheFilePath;
  381. }
  382. /**
  383. * コンパイル済みファイルの書き込み
  384. *
  385. * @param string $tplFileName テンプレート ファイル
  386. * @param string $cacheId キャッシュ ID
  387. * @param string $content ウェブページ
  388. */
  389. 保護された関数 _writeCompile($tplFileName,$content) ,$cacheId)
  390. {
  391. $compileFilePath=$this->gt;_getCompileFile($tplFileName,$cacheId);//ファイル名を保存
  392. if(!file_exists( dirname($compileFilePath))){
  393. $this->makeDir(dirname($compileFilePath));
  394. }
  395. file_put_contents($compileFilePath,$content);
  396. return $compileFilePath;
  397. }
  398. /**
  399. * オペレーティング システムに適した形式にパスを修正します
  400. *
  401. * @param string $path path name
  402. * @return string
  403. */
  404. 保護された関数 _trimPath( $path)
  405. {
  406. return rtrim(str_replace(array('/', '\', '//', '\\'),DIR_SEP, $path),DIR_SEP);
  407. }
  408. /**
  409. * 指定されたパスに基づいて存在しないフォルダーを作成します
  410. *
  411. * @param string $path パス/フォルダー名
  412. * @return文字列
  413. */
  414. 保護関数 _makeDir( $path)
  415. {
  416. $dirs =explode(DIR_SEP, $this ->_trimPath($path));
  417. $tmp = '';
  418. foreach ($dirs as $dir)
  419. {
  420. $tmp .= $dir . DIR_SEP;
  421. if (!file_exists($tmp) && !@mkdir($tmp, 0777))
  422. return $tmp;
  423. }
  424. return true;
  425. }
  426. /**
  427. * 変数処理
  428. *
  429. * @param string $string target string
  430. * @return string
  431. */
  432. 保護された関数 _parseVar($string ){
  433. $pattern=array(
  434. '/^',
  435. '/>$/',
  436. '/( $w+|[^>s]+)/e',//$title|striptags|html2text
  437. '/($[w]+.[w]+ )/e',
  438. );
  439. $replacement=array(
  440. "
  441. ' ?>',
  442. "$ this->_parseModifier('\1');",
  443. "$this->_parsePoint('\1');",
  444. );
  445. returntripslashes(preg_replace($pattern, $replacement, $string));
  446. }
  447. /**
  448. * 变量调节器的处理
  449. *
  450. * @param string $string 模板中匹配到的变量
  451. * @return string 处理后的字符串
  452. */
  453. protected function _parseModifier($string)
  454. {
  455. $arr=explode('|', trim($string,';'));
  456. $tmp=array_shift($arr);
  457. foreach($arr as $value)
  458. {
  459. $tmpArr=explode(':',$value);//html2text
  460. $funcName=array_shift($tmpArr);//html2text
  461. $args=count($tmpArr)>0?','.join(',',$tmpArr):'';//参数用,号链接 arg1,arg2,arg3
  462. if(!function_exists($funcName)){//如果不是PHP内置函数则包含插件
  463. if(!file_exists($this->_options['plugins_dir'].'modifier_'.$funcName.'.php')){
  464. $this->_throwException('插件"'.$funcName.'"不存在');
  465. }
  466. $pluginFileName='modifier_'.$funcName.'.php';
  467. if(!in_array($pluginFileName, $this->includePlugins)){
  468. $this->includePlugins[]=$pluginFileName;//添加include插件
  469. }
  470. $tmp="dolr_modifier_{$funcName}($tmp{$args})";
  471. }else{
  472. $tmp="{$funcName}($tmp{$args})";
  473. }
  474. }
  475. return stripslashes($tmp.';');
  476. }
  477. /**
  478. * 数组操作的点支持
  479. *
  480. * @param string $string 目标字符串
  481. * @return string
  482. */
  483. protected function _parsePoint($string)
  484. {
  485. $arr=explode('.',$string);//$a.b.c.f
  486. $varName=array_shift($arr);//$a
  487. return $varName.'[\''.join('\'][\'',$arr).'\']';//$a['b']['c']['f']
  488. }
  489. /**
  490. * 去掉自定义标签
  491. *
  492. * @param string $expr 源文
  493. * @param string $statement 替换目标
  494. * @return string
  495. */
  496. protected function _stripvtags($expr, $statement)
  497. {
  498. $expr = str_replace("\\\"", "\"", preg_replace("/\/s", "\\1", $expr));
  499. $statement = str_replace("\\\"", "\"", $statement);
  500. return $expr . $statement;
  501. }
  502. /**
  503. * 抛出一个错误信息
  504. *
  505. * @param string $message
  506. * @return void
  507. */
  508. protected function _throwException($message)
  509. {
  510. trigger_error('DolrViews错误:'.$message);
  511. exit;
  512. }
  513. }
  514. /* vim: set expandtab: */

使用范例:
PHP:
  1. include 'DolrViews.class.php';
  2. $tpl=DolrViews::getInstance();//单例
  3. $_options=array(
  4. 'template_dir'=>'templates',//模板目录
  5. 'compile_dir'=>'templates_c',//编译目录
  6. 'cache_dir'=>'cache',//缓存目录
  7. 'caching'=>false,//是否缓存
  8. 'cache_lifetime'=>3600,//缓存有效期
  9. 'plugins_dir'=>'plugins',//插件目录
  10. 'tpl_suffix'=>'html',//模板后缀
  11. );
  12. $tpl->setOptions($_options);//保存如上设置
  13. $title="标题测试啊";
  14. $val=3;
  15. $array=array(
  16. array('username'=>'Joychao','password'=>'nowpass'),
  17. array('username'=>'DolrPHP','password'=>'password'),
  18. );
  19. $var='这里是带标签的HTML';
  20. //分配变量
  21. $tpl->assign('val',$val);
  22. $tpl->assign('title',$title);
  23. $tpl->assign('array',$array);
  24. //显示
  25. $tpl->display('index.html');
模板index.html:
  1. --包含文件----------------------------
  2. ------if else------------------------
  3. do anything
  4. do another
  5. Do not
  6. ---------------------------------
  7. ------loop------------------------
  8. 循环内容

  9. 交互式显示:
  10. 循环中的变量:
  11. ループ内のインデックス $dolr_index:ccc

  12. コンテンツなし
  13. ---------------- --- -------------
  14. --含まれるファイル--------------- --- -------
  15. ------------ --- ---------------

目次の例:
ドルビュー数/
|--cache //キャッシュディレクトリ
|--plugins //プラグインディレクトリ
|--templates //テンプレート ディレクトリ
|--templates_c //コンパイルファイルディレクトリ
|--DolrViews.classs.php //エンジンメインファイル
|--index.php //テストファイル


現在、プラグインは 1 つのテストのみを作成しています。プラグインの仕様は modifier_function name.php です。コンテンツ関数名: dolr_modifier_function 名 ($最初のパラメータは [, その他のパラメータ] である必要があります)。例:
  1. 関数 dolr_modifier_html2text($string)
  2. {
  3. returnstrip_tags($string);
  4. }

今日これを書きました。皆さんもぜひ投稿してください。 こちらも大歓迎です @安正超!

声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
スカラータイプ、リターンタイプ、ユニオンタイプ、ヌル可能なタイプなど、PHPタイプのヒントはどのように機能しますか?スカラータイプ、リターンタイプ、ユニオンタイプ、ヌル可能なタイプなど、PHPタイプのヒントはどのように機能しますか?Apr 17, 2025 am 12:25 AM

PHPタイプは、コードの品質と読みやすさを向上させるためのプロンプトがあります。 1)スカラータイプのヒント:php7.0であるため、基本データ型は、int、floatなどの関数パラメーターで指定できます。 3)ユニオンタイプのプロンプト:PHP8.0であるため、関数パラメーターまたは戻り値で複数のタイプを指定することができます。 4)Nullable Typeプロンプト:null値を含めることができ、null値を返す可能性のある機能を処理できます。

PHPは、オブジェクトのクローニング(クローンキーワード)と__Clone Magicメソッドをどのように処理しますか?PHPは、オブジェクトのクローニング(クローンキーワード)と__Clone Magicメソッドをどのように処理しますか?Apr 17, 2025 am 12:24 AM

PHPでは、クローンキーワードを使用してオブジェクトのコピーを作成し、\ _ \ _クローンマジックメソッドを使用してクローン動作をカスタマイズします。 1.クローンキーワードを使用して浅いコピーを作成し、オブジェクトのプロパティをクローン化しますが、オブジェクトのプロパティはクローニングしません。 2。\ _ \ _クローン法は、浅いコピーの問題を避けるために、ネストされたオブジェクトを深くコピーできます。 3.クローニングにおける円形の参照とパフォーマンスの問題を避けるために注意し、クローニング操作を最適化して効率を向上させます。

PHP対Python:ユースケースとアプリケーションPHP対Python:ユースケースとアプリケーションApr 17, 2025 am 12:23 AM

PHPはWeb開発およびコンテンツ管理システムに適しており、Pythonはデータサイエンス、機械学習、自動化スクリプトに適しています。 1.PHPは、高速でスケーラブルなWebサイトとアプリケーションの構築においてうまく機能し、WordPressなどのCMSで一般的に使用されます。 2。Pythonは、NumpyやTensorflowなどの豊富なライブラリを使用して、データサイエンスと機械学習の分野で驚くほどパフォーマンスを発揮しています。

さまざまなHTTPキャッシングヘッダー(例:キャッシュコントロール、ETAG、ラスト変更)を説明してください。さまざまなHTTPキャッシングヘッダー(例:キャッシュコントロール、ETAG、ラスト変更)を説明してください。Apr 17, 2025 am 12:22 AM

HTTPキャッシュヘッダーの主要なプレーヤーには、キャッシュコントロール、ETAG、およびラスト修飾が含まれます。 1.Cache-Controlは、キャッシュポリシーを制御するために使用されます。例:キャッシュコントロール:Max-Age = 3600、public。 2。ETAGは、一意の識別子を介してリソースの変更を検証します。例:ETAG: "686897696A7C876B7E"。 3. Last-Modifiedは、リソースの最後の変更時間を示しています。

PHPでの安全なパスワードハッシュ(例:Password_hash、password_verify)を説明します。 MD5またはSHA1を使用してみませんか?PHPでの安全なパスワードハッシュ(例:Password_hash、password_verify)を説明します。 MD5またはSHA1を使用してみませんか?Apr 17, 2025 am 12:06 AM

PHPでは、Password_hashとpassword_verify関数を使用して安全なパスワードハッシュを実装する必要があり、MD5またはSHA1を使用しないでください。 1)password_hashセキュリティを強化するために、塩値を含むハッシュを生成します。 2)password_verifyハッシュ値を比較して、パスワードを確認し、セキュリティを確保します。 3)MD5とSHA1は脆弱であり、塩の値が不足しており、最新のパスワードセキュリティには適していません。

PHP:サーバー側のスクリプト言語の紹介PHP:サーバー側のスクリプト言語の紹介Apr 16, 2025 am 12:18 AM

PHPは、動的なWeb開発およびサーバー側のアプリケーションに使用されるサーバー側のスクリプト言語です。 1.PHPは、編集を必要とせず、迅速な発展に適した解釈言語です。 2。PHPコードはHTMLに組み込まれているため、Webページの開発が簡単になりました。 3。PHPプロセスサーバー側のロジック、HTML出力を生成し、ユーザーの相互作用とデータ処理をサポートします。 4。PHPは、データベースと対話し、プロセスフォームの送信、サーバー側のタスクを実行できます。

PHPとWeb:その長期的な影響を調査しますPHPとWeb:その長期的な影響を調査しますApr 16, 2025 am 12:17 AM

PHPは過去数十年にわたってネットワークを形成しており、Web開発において重要な役割を果たし続けます。 1)PHPは1994年に発信され、MySQLとのシームレスな統合により、開発者にとって最初の選択肢となっています。 2)コア関数には、動的なコンテンツの生成とデータベースとの統合が含まれ、ウェブサイトをリアルタイムで更新し、パーソナライズされた方法で表示できるようにします。 3)PHPの幅広いアプリケーションとエコシステムは、長期的な影響を促進していますが、バージョンの更新とセキュリティの課題にも直面しています。 4)PHP7のリリースなど、近年のパフォーマンスの改善により、現代の言語と競合できるようになりました。 5)将来的には、PHPはコンテナ化やマイクロサービスなどの新しい課題に対処する必要がありますが、その柔軟性とアクティブなコミュニティにより適応性があります。

なぜPHPを使用するのですか?利点と利点が説明されましたなぜPHPを使用するのですか?利点と利点が説明されましたApr 16, 2025 am 12:16 AM

PHPの中心的な利点には、学習の容易さ、強力なWeb開発サポート、豊富なライブラリとフレームワーク、高性能とスケーラビリティ、クロスプラットフォームの互換性、費用対効果が含まれます。 1)初心者に適した学習と使用が簡単。 2)Webサーバーとの適切な統合および複数のデータベースをサポートします。 3)Laravelなどの強力なフレームワークを持っています。 4)最適化を通じて高性能を達成できます。 5)複数のオペレーティングシステムをサポートします。 6)開発コストを削減するためのオープンソース。

See all articles

ホットAIツール

Undresser.AI Undress

Undresser.AI Undress

リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover

AI Clothes Remover

写真から衣服を削除するオンライン AI ツール。

Undress AI Tool

Undress AI Tool

脱衣画像を無料で

Clothoff.io

Clothoff.io

AI衣類リムーバー

AI Hentai Generator

AI Hentai Generator

AIヘンタイを無料で生成します。

ホットツール

SublimeText3 英語版

SublimeText3 英語版

推奨: Win バージョン、コードプロンプトをサポート!

mPDF

mPDF

mPDF は、UTF-8 でエンコードされた HTML から PDF ファイルを生成できる PHP ライブラリです。オリジナルの作者である Ian Back は、Web サイトから「オンザフライ」で PDF ファイルを出力し、さまざまな言語を処理するために mPDF を作成しました。 HTML2FPDF などのオリジナルのスクリプトよりも遅く、Unicode フォントを使用すると生成されるファイルが大きくなりますが、CSS スタイルなどをサポートし、多くの機能強化が施されています。 RTL (アラビア語とヘブライ語) や CJK (中国語、日本語、韓国語) を含むほぼすべての言語をサポートします。ネストされたブロックレベル要素 (P、DIV など) をサポートします。

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

このプロジェクトは osdn.net/projects/mingw に移行中です。引き続きそこでフォローしていただけます。 MinGW: GNU Compiler Collection (GCC) のネイティブ Windows ポートであり、ネイティブ Windows アプリケーションを構築するための自由に配布可能なインポート ライブラリとヘッダー ファイルであり、C99 機能をサポートする MSVC ランタイムの拡張機能が含まれています。すべての MinGW ソフトウェアは 64 ビット Windows プラットフォームで実行できます。

SublimeText3 中国語版

SublimeText3 中国語版

中国語版、とても使いやすい

SublimeText3 Mac版

SublimeText3 Mac版

神レベルのコード編集ソフト(SublimeText3)