/**
* 機能: カテゴリの使用量を減らすために条件に基づいてカテゴリ キャッシュを作成します
* 作成日: Thu May 31 15:55:11 CST 2007
* 最終更新日:
* 著者: sanshi
classtreeCache
{
var $tableName = "index_category"; //テーブル名
var $where = "1"; //where 条件
var $; pidStr = "i_c_pid"; //pid
varのフィールド名 $tempCode = array() //生成されたファイルの配列
var $pid = '0' //pid
varの初期値 $db;ハンドル
var $idStr="i_c_id"; //取得したデータ ID
var $title = "i_c_cn"; //名前フィールド
var $createArrayName = "treeCache" //作成された配列の名前
var $createFileName =" "; // ファイルの名前を作成します
var $appendArr = array(); // 追加の属性、フィールド名はデータ内の名前に対応する必要があります
var $is_utf8 = false;
{
}
function set($db)
{
$this->db = $db;
$this->tempCode[] = "}
//最初にすべてを取得します。レベル
function getRootID()
{
$sql = "SELECT {$this->idStr} FROM {$this->tableName} WHERE
{$this->pidStr}='{$this->pid }' AND {$this ->where} ";
//exit($sql);
$result = $this->db->select($sql);
$temp = array();
foreach ($result as $ r)
{
$temp[]=$r["{$this->idStr}"]
}
$this->tempCode[] = "${$this-> ;createArrayName}['root ']='".implode(',',$temp)."';";
//print_r($temp);
return $temp;
}
//子 ID を取得
function getChildren($pid)
{
$sql = "SELECT {$this->idStr} FROM {$this->tableName} WHERE
{$this->pidStr}='{$pid}' AND { $this->where } ";
$result = $this->db->select($sql);
$temp = array();
foreach ($result as $r)
{
$temp []=$r[ "{$this->idStr}"];
}
return $temp;
//夫の ID を取得
function getParent($cid)
{
$sql = "SELECT {$ this->pidStr} FROM {$this->tableName} WHERE
{$this->idStr}='{$cid}' AND {$this->where} ";
$result = $this- >db->select($sql);
//print_r($result);exit();
return $result[0]["{$this->pidStr}"]
//上司の ID を取得します
function getPidStr($cid,$pidStr="")
{
$pid=$this->getParent($cid);
$temp = array(); this->pid && !emptyempty($pid)) {
$temp[] = $pid=$this->getParent($pid);
//print_r($temp); return implode(',' ,$temp);
//深さ
関数を取得します getDepth($cid,$ Depth=0)
{
$pid=$this->getParent($cid);深さ++;
if( $pid != $this->pid && !emptyempty($pid))
$ Depth = $this->getDepth($pid,$ Depth); /ファイルの作成
function make( )
{
if(emptyempty($this->createFileName))
$this->createFileName = "{$this->createArrayName}.data.php";
$rootArr = $this->getRootID ();
$selectF = "{$this->idStr},{$this->pidStr}"; ;appendArr as $app)
{
if(emptyempty($app)) 続行;
$selectF .=",{$app}"
}
$sql = "SELECT {$selectF} FROM {$this-> ;tableName} WHERE
{$ this->where}";
$result = $this->db->select($sql);
for ($i=0;$i
//id 値
$this->tempCode[] =
"${$this->createArrayName}['{$result[$i][$this->idStr]} ']['id'] ='{$result[$i]["{$this->idStr}"]}';";
//タイトル
$this->tempCode[] =
"$ {$this->createArrayName }['{$result[$i][$this->idStr]}']['title']='{$result[$i]["{$this-> title}"]}'; ";
//親 ID
$this->tempCode[] =
"${$this->createArrayName}['{$result[$i][$this-> idStr]}'][' pid']='{$result[$i]["{$this->pidStr}"]}';";
//サブ ID
$this->tempCode[ ] =
"${$this ->createArrayName}['{$result[$i][$this->idStr]}']['cid']='".implode(',',$this ->getChildren($result[ $i]["$this->idStr"]))."';"
//ディレクトリの深さ
$this->tempCode[] =
"${$this ->createArrayName}['{ $result[$i][$this->idStr]}']['深さ']='".$this->getDepth($result[$i]["$ this->idStr"]) ."';";
//親 ID の ID 文字列
$this->tempCode[] =
"${$this->createArrayName}['{$result [$i][$this->idStr]}']['pstr']='".$this->getPidStr($result[$i]["$this->idStr"])。 ';";
//追加プロパティ
foreach ($this->appendArr as $app)
{
if(emptyempty($app)) continue;
$this->tempCode[] =
"${ $this->createArrayName}[' {$result[$i][$this->idStr]}']['{$app}']='{$result[$i]["{$app} "]}';";
}
}
$this->tempCode[] = "${$this->createArrayName} を返す;";
$this->tempCode[] = "?>";
//$content = implode("n",$this->tempCode);
//print_r($this->tempCode );
$content = implode("n",$this->tempCode);
//ファイルを作成します
$fio=Factory::getBaseClass('FileIO');
if($this->is_utf8) content = "xEFxBBxBF".$content;
$fio->writeFile($this->createFileName,$content);
return $content ;
}
}
//ロードされたファイルはデータベース接続用です
/データベースに select メソッドが必要です
/*
include_once(dirname(dirname(__FILE__))."/config/config.inc.php");
include_once(CLASSES_PATH."factryObject.class.php"); =factryObject::getDB('indexPush');
$c = newtreeCache($db);
//exit();
include_once(" .data.php");
$treeCache=isset($treeCache) ? $treeCache : array();
$rootStr = isset($treeCache['root']) ? $treeCache['root'] : "";
echo parseTree($treeCache,$rootStr);
function parseTree($treeCache,$rootStr)
{
$tempStr = "";
foreach ($temp AS); $cid)
{
$info = $treeCache[$cid];
$cidStr = $info['cid']
$tempStr .= str_repeat('-',($info['深さ']-1) *3);
$tempStr.=$info['title'];
if(empty($info['pid']))
{
//追加の操作
}
$tempStr .= "
";
if(!empty($info['cid']))
$tempStr .=parseTree($treeCache,$info['cid']);
}
return $tempStr;
}
*/
?>
/**
* 機能: カテゴリの使用量を減らすために条件に基づいてカテゴリ キャッシュを作成します
* 作成日: Thu May 31 15:55:11 CST 2007
* 最終更新日:
* 著者: sanshi
class TreeCache
{
var $tableName = "index_category" //テーブル名
var $where = "1";
var $pidStr ="i_c_pid"; //pid
varのフィールド名 $tempCode = array(); //生成されるファイルの配列
var $pid = '0' //pid
varの初期値//データベースハンドル
var $idStr="i_c_id"; //取得したデータ ID
var $title = "i_c_cn"; //名前フィールド
var $createArrayName = "treeCache"; //作成された配列名
var = ""; //ファイルの名前を作成します
var $appendArr = array(); //追加の属性、フィールド名はデータ内の名前に対応する必要があります
var $is_utf8 = false;
{
}
function set($db)
{
$this->db = $db;
$this->tempCode[] = "//最初にすべてを取得します。レベル
function getRootID()
{
$sql = "SELECT {$this->idStr} FROM {$this->tableName} WHERE
{$this->pidStr}='{$this->pid }' AND {$this->where} ";
//exit($sql);
$result = $this->db->select($sql);
$temp = array();
foreach ($ 結果を $r)
{
$temp[]=$r["{$this->idStr}"]
}
$this->tempCode[] = "${$this-> ;createArrayName} ['root']='".implode(',',$temp)."';";
//print_r($temp);
return $temp;
}
//子 ID を取得する
function getChildren( $pid)
{
$sql = "SELECT {$this->idStr} FROM {$this->tableName} WHERE
{$this->pidStr}='{$pid}' AND {$this->where} ";
$result = $this->db->select($sql);
$temp = array();
foreach ($result as $r)
{
$ temp[]= $r["{$this->idStr}"];
}
return $temp;
//夫のIDを取得
function getParent($cid)
{
$sql = "SELECT { $this-> ;pidStr} FROM {$this->tableName} WHERE
{$this->idStr}='{$cid}' AND {$this->where} ";
$result = $this ->db ->select($sql);
//print_r($result);exit();
return $result[0]["{$this->pidStr}"]
/ /上位 ID を取得
function getPidStr($cid,$pidStr="")
{
$pid=$this->getParent($cid);
$temp = array(); this-> ;pid && !empty($pid)) {
$temp[] = $pid=$this->getParent($pid);
//print_r($temp); return implode( ',',$temp);
//深度を取得する
function getDepth($cid,$ Depth=0)
{
$pid=$this->getParent($cid);深さ++;
if ( $pid != $this->pid && !empty($pid))
$ Depth = $this->getDepth($pid,$ Depth); /ファイルの作成
関数 make()
{
if(empty($this->createFileName))
$this->createFileName = "{$this->createArrayName}.data.php"; = $this->getRootID();
$selectF = "{$this->idStr},{$this->pidStr}"; ;appendArr as $app)
{
if(empty($app)) 続行
$selectF .=",{$app}"
}
$sql = "SELECT {$selectF} FROM {$this-> ;tableName} WHERE
{$this->where}";
$result = $this->db->select($sql);
for ($i=0;$i
//id 値
$this->tempCode[] =
"${$this->createArrayName}['{$result[$i][$this->idStr]}']['id']='{$result[$i]["{$this->idStr}"]}';";
//标题
$this->tempCode[] =
"$ {$this->createArrayName}['{$result[$i][$this->idStr]}']['title']='{$result[$i]["{$this-> title}"]}';";
//父id
$this->tempCode[] =
"${$this->createArrayName}['{$result[$i][$this-> idStr]}']['pid']='{$result[$i]["{$this->pidStr}"]}';";
//子id
$this->tempCode[] =
"${$this->createArrayName}['{$result[$i][$this->idStr]}']['cid']='".implode(',',$this- >getChildren($result[$i]["$this->idStr"]))."';"
//目录深度
$this->tempCode[] =
"${$this- >createArrayName}['{$result[$i][$this->idStr]}']['深さ']='".$this->getDepth($result[$i]["$this ->idStr"])."';";
//父idのid串
$this->tempCode[] =
"${$this->createArrayName}['{$result[$i ][$this->idStr]}']['pstr']='".$this->getPidStr($result[$i]["$this->idStr"])."';" ;
//追加の追加プロパティ
foreach ($this->appendArr as $app)
if(empty($app)) continue
$this->tempCode[] =
" ->createArrayName}['{$result[$i][$this->idStr]}']['{$app}']='{$result[$i]["{$app}"] }';";
}
}
$this->tempCode[] = "${$this->createArrayName} を返します;";
$this->tempCode[] = "?>";
//$content = implode("n",$this->tempCode);
//print_r($this->tempCode);
$content = implode("n",$this->tempCode);
//建立文件
$fio=Factory::getBaseClass('FileIO');
if($this->is_utf8) $content = "xEFxBBxBF".$content;
$fio->writeFile($this->createFileName,$content);
$content を返す ;
}
}
//追加された文件は了のために、データ库接続
//データ库が必要です select メソッド
/*
include_once(dirname(dirname(__FILE__))."/config/config.inc.php");
include_once(CLASSES_PATH."factryObject.class.php");
$db =factoryObject::getDB('indexPush');
$c = 新しいツリーキャッシュ($db);
$c->make();
//終了();
//做分析
include_once("treeCache.data.php");
$treeCache=isset($treeCache) ? $treeCache : array();
$rootStr = isset($treeCache['root']) ? $treeCache['root'] : "";
echo parseTree($treeCache,$rootStr);
関数parseTree($treeCache,$rootStr)
{
$tempStr = "";
$temp =explode(',',$rootStr);
foreach ($temp AS $cid)
{
$info = $treeCache[$cid];
$cidStr = $info['cid'];
$tempStr .= str_repeat('-',($info['深さ']-1)*3);
$tempStr.=$info['タイトル'];
if(empty($info['pid']))
{
//追加操作
}
$tempStr .= "
";
if(!empty($info['cid']))
$tempStr .=parseTree($treeCache,$info['cid']);
}
$tempStr を返します。
}
*/
?>
これは改善されたもので、当初はこれの組み合わせであり、数字の機能としてのみ可能であり、次の文字母了をサポートしています
另外就は解析に関するものです
クリップボードプリントへのプレーンコピーを表示しますか?
class parseTree
{
var $ads_type_file = "";
var $isX = false;
var $rowSize=2;
function parseTree()
{
$this->ads_type_file = CACHE_PATH."ads_type_arr.data.php";
$this->ads_city_file = CACHE_PATH."ads_city_arr.data.php";
}
関数 make_ads_type()
{
$db = Factory::getDB("ads_type");
$tree =Factory::getItemClass('treeCache');
$tree->set($db);
$tree->テーブル名=$db->テーブル名;
$tree->pidStr ="ads_type_pid";
$tree->idStr = "ads_type_id";
$tree->title = "広告タイプ名";
$tree->createArrayName ="ads_type_arr";
$tree->where = " ads_type_state=1 ORDER BY ads_type_id DESC ";
$tree->appendArr = array("ads_type_info");
$tree->createFileName = $this->ads_type_file;
$tree->is_utf8 = true;
return $tree->make();
}
関数 get_ads_type_str()
{
$temp_arr = $this->get_ads_type_arr();
$treeArr = emptyempty($temp_arr) ? array() : $temp_arr;
$rootStr = isset($temp_arr['root']) ? $temp_arr['root'] : "";
$show_content = $this->__parseTree($treeArr,$rootStr,'pares_type_link');
$show_content を返します;
}
function get_ads_type_arr()
{
return is_file($this->ads_type_file) ? require($this->ads_type_file) : array();
}
function pares_type_link($info)
{
$class_name = "ads_type";
$tempStr = "[子-追加]";
$tempStr .="[编辑]";
$tempStr .="[删除]";
$tempStr を返します。
}
//提供されたクラスに基づいて类数グループを取得します
function get_type_arr($type_no=0)
{
$temp_arr = $this->get_ads_type_arr();
$rootStr = $type_no==0 ? (isset($temp_arr['root'])?$temp_arr['root'] : "") : (isset($temp_arr[$type_no]['cid'])?$temp_arr[$type_no]['cid' ]:"");
$temp =explode(',',$rootStr);
$return_temp = array();
foreach($temp as $cid)
{
if(isset($temp_arr[$cid])) $return_temp[$temp_arr[$cid]['id']]=$temp_arr[$cid]['title' ];
}
return $return_temp;
}
関数 make_ads_city()
{
$db = Factory::getDB("ads_city");
$tree =Factory::getItemClass('treeCache');
$tree->set($db);
$tree->テーブル名=$db->テーブル名;
$tree->pidStr ="ads_city_pid";
$tree->idStr = "ads_city_no";
$tree->title = "広告都市名";
$tree->createArrayName ="ads_city_arr";
$tree->where = " ads_city_state=1 ORDER BY ads_city_no DESC ";
$tree->appendArr = array("ads_city_info");
$tree->createFileName = $this->ads_city_file;
$tree->is_utf8 = true;
return $tree->make();
}
関数 get_ads_city_arr()
{
return is_file($this->ads_city_file) ? require($this->ads_city_file) : array();
}
関数 get_ads_city_str()
{
$temp_arr = $this->get_ads_city_arr();
$treeArr = emptyempty($temp_arr) ? array() : $temp_arr;
$rootStr = isset($temp_arr['root']) ? $temp_arr['root'] : "";
$show_content = $this->__parseTree($treeArr,$rootStr,'pares_city_link');
$show_content を返します;
}
function pares_city_link($info)
{
$class_name = "ads_city";
$tempStr = "[子-追加]";
$tempStr .="[编辑]";
$tempStr .="[删除]";
$tempStr を返します。
}
//準拠城市号取得城市数组
function get_city_arr($city_no=0)
{
$temp_arr = $this->get_ads_city_arr();
$rootStr = $city_no==0 ? (isset($temp_arr['root'])?$temp_arr['root'] : "") : (isset($temp_arr[$city_no])?$temp_arr[$city_no]:"");
$temp =explode(',',$rootStr);
$return_temp = array();
foreach($temp as $cid)
{
if(isset($temp_arr[$cid])) $return_temp[$temp_arr[$cid]['id']]=$temp_arr[$cid]['title' ];
}
return $return_temp;
}
function __parseTree($treeCache,$rootStr,$fuc_str)
{
$tempStr = "";
$temp =explode(',',$rootStr);
if(emptyempty($temp)) return "";
$this->layer=0;
foreach ($temp AS $cid)
{
if(isset($treeCache[$cid]))
{
$info = $treeCache[$cid];
$cidStr = $info['cid'];
//如果下面有子id
if($info["cid"]!="")
{
$tempStr .="
$tempStr .= str_repeat(' ',($info['深さ']-1)*3);
if($info["cid"]!="")
{
//$tempStr .="

}
//$tempStr .=">";
$tempStr.=$info['タイトル'];
$tempStr .=$this->{$fuc_str}($info);
$tempStr .="
$tempStr .="
$tempStr .= $this->__parseTree($treeCache,$info['cid'],$fuc_str);
$tempStr .="
}else{
$this->layer++;
$tempStr .= str_repeat(' ',($info['深さ']-1)*3);
$tempStr.=$info['タイトル'];
$tempStr .=$this->{$fuc_str}($info);
if($this->isX==true)
{
if($this->layer % $this->rowSize ==0)
$tempStr .= "
";
else
$tempStr .= " ";
}else{
$tempStr .= "
";
}
}
}
}
return $tempStr;
}
}
?>

PHPは、現代のWeb開発、特にコンテンツ管理とeコマースプラットフォームで依然として重要です。 1)PHPには、LaravelやSymfonyなどの豊富なエコシステムと強力なフレームワークサポートがあります。 2)パフォーマンスの最適化は、Opcacheとnginxを通じて達成できます。 3)PHP8.0は、パフォーマンスを改善するためにJITコンパイラを導入します。 4)クラウドネイティブアプリケーションは、DockerおよびKubernetesを介して展開され、柔軟性とスケーラビリティを向上させます。

PHPは、特に迅速な開発や動的なコンテンツの処理に適していますが、データサイエンスとエンタープライズレベルのアプリケーションには良くありません。 Pythonと比較して、PHPはWeb開発においてより多くの利点がありますが、データサイエンスの分野ではPythonほど良くありません。 Javaと比較して、PHPはエンタープライズレベルのアプリケーションでより悪化しますが、Web開発により柔軟性があります。 JavaScriptと比較して、PHPはバックエンド開発により簡潔ですが、フロントエンド開発のJavaScriptほど良くありません。

PHPとPythonにはそれぞれ独自の利点があり、さまざまなシナリオに適しています。 1.PHPはWeb開発に適しており、組み込みのWebサーバーとRich Functionライブラリを提供します。 2。Pythonは、簡潔な構文と強力な標準ライブラリを備えたデータサイエンスと機械学習に適しています。選択するときは、プロジェクトの要件に基づいて決定する必要があります。

PHPは、サーバー側で広く使用されているスクリプト言語で、特にWeb開発に適しています。 1.PHPは、HTMLを埋め込み、HTTP要求と応答を処理し、さまざまなデータベースをサポートできます。 2.PHPは、ダイナミックWebコンテンツ、プロセスフォームデータ、アクセスデータベースなどを生成するために使用され、強力なコミュニティサポートとオープンソースリソースを備えています。 3。PHPは解釈された言語であり、実行プロセスには語彙分析、文法分析、編集、実行が含まれます。 4.PHPは、ユーザー登録システムなどの高度なアプリケーションについてMySQLと組み合わせることができます。 5。PHPをデバッグするときは、error_reporting()やvar_dump()などの関数を使用できます。 6. PHPコードを最適化して、キャッシュメカニズムを使用し、データベースクエリを最適化し、組み込み関数を使用します。 7

PHPが多くのWebサイトよりも優先テクノロジースタックである理由には、その使いやすさ、強力なコミュニティサポート、広範な使用が含まれます。 1)初心者に適した学習と使用が簡単です。 2)巨大な開発者コミュニティと豊富なリソースを持っています。 3)WordPress、Drupal、その他のプラットフォームで広く使用されています。 4)Webサーバーとしっかりと統合して、開発の展開を簡素化します。

PHPは、特にWeb開発の分野で、最新のプログラミングで強力で広く使用されているツールのままです。 1)PHPは使いやすく、データベースとシームレスに統合されており、多くの開発者にとって最初の選択肢です。 2)動的コンテンツ生成とオブジェクト指向プログラミングをサポートし、Webサイトを迅速に作成および保守するのに適しています。 3)PHPのパフォーマンスは、データベースクエリをキャッシュおよび最適化することで改善でき、その広範なコミュニティと豊富なエコシステムにより、今日のテクノロジースタックでは依然として重要になります。

PHPでは、弱い参照クラスを通じて弱い参照が実装され、ガベージコレクターがオブジェクトの回収を妨げません。弱い参照は、キャッシュシステムやイベントリスナーなどのシナリオに適しています。オブジェクトの生存を保証することはできず、ごみ収集が遅れる可能性があることに注意する必要があります。

\ _ \ _ Invokeメソッドを使用すると、オブジェクトを関数のように呼び出すことができます。 1。オブジェクトを呼び出すことができるように\ _ \ _呼び出しメソッドを定義します。 2。$ obj(...)構文を使用すると、PHPは\ _ \ _ Invokeメソッドを実行します。 3。ロギングや計算機、コードの柔軟性の向上、読みやすさなどのシナリオに適しています。


ホットAIツール

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

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

Undress AI Tool
脱衣画像を無料で

Clothoff.io
AI衣類リムーバー

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

人気の記事

ホットツール

SAP NetWeaver Server Adapter for Eclipse
Eclipse を SAP NetWeaver アプリケーション サーバーと統合します。

DVWA
Damn Vulnerable Web App (DVWA) は、非常に脆弱な PHP/MySQL Web アプリケーションです。その主な目的は、セキュリティ専門家が法的環境でスキルとツールをテストするのに役立ち、Web 開発者が Web アプリケーションを保護するプロセスをより深く理解できるようにし、教師/生徒が教室環境で Web アプリケーションを教え/学習できるようにすることです。安全。 DVWA の目標は、シンプルでわかりやすいインターフェイスを通じて、さまざまな難易度で最も一般的な Web 脆弱性のいくつかを実践することです。このソフトウェアは、

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

メモ帳++7.3.1
使いやすく無料のコードエディター

AtomエディタMac版ダウンロード
最も人気のあるオープンソースエディター
