str_replace
ファイル名を入力しようとすると、値ではなく名前をファイルfff.php
に出力できません$var
。
<?PHP
$path_to_file = 'fff.php';
$var_str = var_export($viewer, true);
$file_contents = file_get_contents($path_to_file);
$file_contents = str_replace("//","case \"13\";
$viewer =\"jjhj/jhjh/344.mp3\"; //I put value to variable
echo $viewer ; //Here I need to print the $ and name of the variable only
break;
//",$file_contents);
file_put_contents($path_to_file,$file_contents);
echo "your file is ok";
?>
値ではなく変数の名前を置き換えようとすると、結果がどうなるかを見てください-
fff.php
<?php
$id=$_GET['id'];
switch ($id){
case "1";
$viewer = "jhhghg/pic1.jpg";
echo $viewer ;
break ;
// my str_replace starting
case "13";
="jjhj/jhjh/344.mp3"; //I put value to variable but now name empty
echo ; //Here I need to print the $ and name of the variable only also here
break;
//
//my str_replace end
default;
echo"your request error";
}
?>
that's my problem I need only print the variable name. How do I do that?