PHPコレクションクラス
PHP コード
url); Return $ PageContent;}/** * タグに基づいてリストセグメントを取得 * @param $content ページのソースデータ * @return String リストセグメントのコンテンツ*/Function GetContentPiece ($ Content) {$ ConTEN t = $this-& gt ; getContent ($ this->startFlag, $this->endFlag ); /*** 文字列の特定の部分を取得 * @param $sourceStr ソースデータ * @param $startStr 分離部分の開始タグ * @param $endStart 分離部分の終了タグ * @return boolean 操作が成功した場合は true を返します*/ function getContent ( $sourceStr, $startStr, $endStart ) { $s = preg_quote( decode( $startStr ) ); $e = preg_quote( decode( $endStart ) ); $s = str_replace( " ", "[[:space:]]", $s ); $e = str_replace( " ", "[[:space:]]", $e ); $s = str_replace( "rn", "[[:cntrl:]]", $s ); $e = str_replace( "rn", "[[:cntrl:]]", $e ); preg_match_all( "@" . $s . "(.*?)". $e ."@is", $sourceStr, $tpl ); $content = $tpl[1]; $content = implode( "", $content ); $content を返します。 } function cut ( $sourceStr, $startStr, $endStr ) { return cut( $sourceStr ,decode( $startStr ) ,decode( $endStr) ); } /*** 接続とコンテンツのみを含むリスト配列を取得 * @param $sList ページ リスト ソース データ * @return array リスト セグメント コンテンツ*/ function getSourceList ( $sList ) { preg_match_all( "//i", $sList, $list ); $list = $list[0]; //foreach($list as $l) echo $l; if(!$list || !is_array($list)){ Return $this->getSourceListExtend($sList); }else{ return $this->getList ( $list ); } } function getSourceListExtend($sList) { $content=explode(" ",$sList); for($i=0;$i"; //title if(eregi(">",$list[$i])){ $temp_title=substr(strrchr($list[$i], ">"), 1 ); $temp_title=preg_replace( "@<(.*?)>@is","",$temp_title); $temp_title=str_replace( ">","",$ temp_title); $temp_title=str_replace( "<","",$temp_title); if(!$temp_title) $temp_title=$list[$i] ; $temp_title=preg_replace( "@<(.*) ?) >@は","",$temp_title); $temp_title=str_replace( ">","",$temp_title); $temp_title=str_replace( "<","",$temp_title); echo $temp_title."
"; }else{ $temp_title=$list[$i]; $temp_title=preg_replace( "@@is","",$temp_title); $temp_title=str_replace( ">","",$temp_title); $temp_title=str_replace( "<","",$temp_title); echo $temp_title."
"; } //获取的データ正确 if( !emptyempty( $temp_link ) && !emptyempty( $temp_title) ) { if( 0 == strpos( $tempc[2][0], "/" ) ) { preg_match( "@ http://(.*?)/@i", $this->URL, $url ); $temp_link = substr( $url[0], 0, strlen( $url[0] ) - 1 ) 。 $temp_link; } $listContent[$i][0] = trim($temp_title); $listContent[$i][1] = $temp_link; } } return $listContent; } /*** テキスト内の画像パス情報を取得 * @param $content テキスト情報 * @return array 情報内の画像パスの配列*/ function getImageList ( $content ) { preg_match_all( "/src=("|')(.*?)("|')/i", $content, $temp ); $imageList = $temp[2]; return array_unique($imageList); } /*** 画像をダウンロードするときにページ内のパスを新しいパスに置き換えます * @param $content 置き換える必要があるページのコンテンツ * @return String 置き換えられたページのコンテンツ*/ function replaceImageParh ( $content ) { for ( $i = 0; $i < count( $this->ImageList ); $i++ ) { if($this->ファイル名[$ i]){ $content = str_replace( $this->ImageList[$i], $this->imageURL.$this->FileName[$i], $content ); }else{ //$s=" /src=(\"|')".preg_quote($this->ImageList[$i])."(\"|')/i"; $content = str_replace($this->ImageList[$i], $GLOBALS[SET][webpath]."images/nopic.gif", $content ); } } return $content; } /*** 画像をダウンロードする場合、画像ファイルを読み取り、対応するパスに保存します * @param $imageURL 読み取る必要がある画像ファイル * @return boolean 操作が成功した場合は true を返します*/ function saveImage ( $imageURL ) { for ( $i = 0; $i < count( $imageURL ); $i++ ) { $fName = $ this->saveFile( $imageURL[ $i] ); if( !emptyempty( $fName ) ) { $filename[$i] = $fName; } } return $filename; } function saveFile( $fileName ) { $s_filename = basename( $fileName ); $ext_name = strto lower( strrchr( $s_filename, "." ) ); if( ( ".jpg" && ".gif" && ".swf" ) != strto lower( $ext_name ) ) { return ""; } if( 0 == strpos( $fileName, "/" ) ) { preg_match( "@http://(.*?)/@i", $this->URL, $url ); $url = $url[0]; } if( 0 == strpos( $fileName, "." ) ) { $url = substr( $this->URL, 0, strrpos( $fileName, "/" ) ); } $contents = @file_get_contents( $url . $fileName ); $s_filename = time()。 ランド( 1000, 9999 ) 。 $ext_name; //file_put_contents( $this->saveImagePath.$s_filename, $contents ); $handle = @fopen ( $this->saveImagePath.$s_filename, "w" ); @fwrite( $handle, $contents ); @fclose($handle); if(filesize($this->saveImagePath.$s_filename)>3072){ return $s_filename; }else{ @unlink($this->saveImagePath.$s_filename); 戻る ""; } } /*** 画像をダウンロードしない場合は、そのパスを絶対パスとしてフォーマットします。 * @return $filename フォーマットされた画像のパスを返します。*/ 関数 ToPath($imageURL) { $PathArray=parse_url($this->URL); $webpath=$PathArray[スキーム]."://".$PathArray[ホスト] ; $filepath=$PathArray[パス] ; for ( $i = 0; $i < count( $imageURL ); $i++ ) { if( substr( $imageURL[$i] ,0,1 )== '/' ){ $filename[$i] = $webpath.$imageURL[$i]; }elseif( substr( $imageURL[$i] ,0,2 )== './' ){ $filename[$i] =$webpath.$filepath.substr( $imageURL[$i] ,1, strlen( $imageURL[$i]) ); }elseif( substr( $imageURL[$i] ,0,3 )== '../' ){ $index=strrchr($filepath,"/"); $filename[$i] =$webpath.substr($filepath,0,$index).substr($imageURL[$i] ,2, strlen( $imageURL[$i])); }elseif(substr( $imageURL[$i] ,0,4)== 'http'){ $filename[$i] =$imageURL[$i] ; }else{ } return $filename; } /*** 画像がダウンロードされていない場合は、ページ内のパスを新しいパスに置き換えます * @param $content 置き換える必要があるページのコンテンツ * @return String 置き換え後のページのコンテンツ*/ function ImgPathReplace( $content ) { ( $i = 0; $i < count( $this->ImageList ); $i++ ) { $content = str_replace( $this-> ;ImageList[$i], $this->FileName[$i], $content ); } $contentを返します。 } function setURL ( $u ) { $this->URL = $u; true を返します。 } function setStartFlag ( $s ) { $this->startFlag = $s; true を返します。 } function setEndFlag ( $e ) { $this->endFlag = $e; true を返します。 } function setSaveImagePath ( $p ) { $this->saveImagePath = $p; true を返します。 } function setImageURL ( $i ) { $this->imageURL = $i; true を返します。 } } ?>

ホットAIツール

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

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

Undress AI Tool
脱衣画像を無料で

Clothoff.io
AI衣類リムーバー

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

人気の記事

ホットツール

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

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

ゼンドスタジオ 13.0.1
強力な PHP 統合開発環境

ドリームウィーバー CS6
ビジュアル Web 開発ツール

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

ホットトピック









Laravelは、直感的なフラッシュメソッドを使用して、一時的なセッションデータの処理を簡素化します。これは、アプリケーション内に簡単なメッセージ、アラート、または通知を表示するのに最適です。 データは、デフォルトで次の要求のためにのみ持続します。 $リクエスト -

PHPクライアントURL(CURL)拡張機能は、開発者にとって強力なツールであり、リモートサーバーやREST APIとのシームレスな対話を可能にします。尊敬されるマルチプロトコルファイル転送ライブラリであるLibcurlを活用することにより、PHP Curlは効率的なexecuを促進します

Laravelは簡潔なHTTP応答シミュレーション構文を提供し、HTTP相互作用テストを簡素化します。このアプローチは、テストシミュレーションをより直感的にしながら、コード冗長性を大幅に削減します。 基本的な実装は、さまざまな応答タイプのショートカットを提供します。 Illuminate \ support \ facades \ httpを使用します。 http :: fake([[ 'google.com' => 'hello world'、 'github.com' => ['foo' => 'bar']、 'forge.laravel.com' =>

顧客の最も差し迫った問題にリアルタイムでインスタントソリューションを提供したいですか? ライブチャットを使用すると、顧客とのリアルタイムな会話を行い、すぐに問題を解決できます。それはあなたがあなたのカスタムにより速いサービスを提供することを可能にします

記事では、PHP 5.3で導入されたPHPの後期静的結合(LSB)について説明し、より柔軟な継承を求める静的メソッドコールのランタイム解像度を可能にします。 LSBの実用的なアプリケーションと潜在的なパフォーマ

この記事では、フレームワークにカスタム機能を追加し、アーキテクチャの理解、拡張ポイントの識別、統合とデバッグのベストプラクティスに焦点を当てています。

記事では、入力検証、認証、定期的な更新など、脆弱性から保護するためのフレームワークの重要なセキュリティ機能について説明します。
