2017-11-02 22 views
1

brocken(画像の私のディレクトリにある)の3つのインスタンスをすべてこのフォームでフォームを使って簡単に変更できますか?そうすれば、いつでも新しい.phpファイルを作成する必要があります。私は単純に入力してEnterキーを押します! スクリプトとボタンの設定に関して、私が何をすべきかを指摘してください。PHPファイルの短いスクリプトにテキストを置き換えます

<?php 

    // Image extensions 
    $image_extensions = array("png","jpg","jpeg","gif"); 

    // Target directory 
    $dir = 'images/brocken'; 
    if (is_dir($dir)){ 

    if ($dh = opendir($dir)){ 
    $count = 1; 

    // Read files 
    while (($file = readdir($dh)) !== false){ 

    if($file != '' && $file != '.' && $file != '..'){ 

    // Thumbnail image path 
    $thumbnail_path = "images/brocken/thumbnail/".$file; 

    // Image path 
    $image_path = "images/brocken/".$file; 

    $thumbnail_ext = pathinfo($thumbnail_path, PATHINFO_EXTENSION); 
    $image_ext = pathinfo($image_path, PATHINFO_EXTENSION); 

などなど

+2

私は従いません。フォームは文字列置換と何が関係していますか? – Utkanos

答えて

0

あなたはこのように意味ですか?

<?php 

    // Image extensions 
    $image_extensions = array("png","jpg","jpeg","gif"); 

    // Target directory 
    $dir = 'images/brocken'; 
    if (is_dir($dir)){ 

    if ($dh = opendir($dir)){ 
    $count = 1; 

    // Read files 
    while (($file = readdir($dh)) !== false){ 

    if($file != '' && $file != '.' && $file != '..'){ 

    // Thumbnail image path 
    $thumbnail_path = "{$dir}/thumbnail/{$file}"; 

    // Image path 
    $image_path = "{$dir}/{$file}"; 

    $thumbnail_ext = pathinfo($thumbnail_path, PATHINFO_EXTENSION); 
    $image_ext = pathinfo($image_path, PATHINFO_EXTENSION); 

あなただけ$dir変数のパスを変更する場合は、$thumbnail_pathを変更しても$image_path

関連する問題