![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
09/01/2016, 11:38
|
| | Fecha de Ingreso: enero-2016
Mensajes: 71
Antigüedad: 9 años, 1 mes Puntos: 14 | |
Respuesta: PHP archivos, encontrar palabra y sustituir Usa alguna de estas funciones:
str_replace($buscar, $reemplazar, $cadena)
[URL="http://php.net/manual/es/function.str-replace.php"]http://php.net/manual/es/function.str-replace.php[/URL]
preg_replace($buscar, $reemplazar, $cadena)
[URL="http://php.net/manual/es/function.preg-replace.php"]http://php.net/manual/es/function.preg-replace.php[/URL]
strtr($cadena, $buscar, $reemplazar)
[URL="http://php.net/manual/es/function.strtr.php"]http://php.net/manual/es/function.strtr.php[/URL]
La variable $cadena contendría el contenido del archivo. Para obtenerlo puedes usar file_get_contents() por ejemplo ...
[URL="http://php.net/manual/es/function.file-get-contents.php"]http://php.net/manual/es/function.file-get-contents.php[/URL]
Última edición por x_atrix; 09/01/2016 a las 11:41
Razón: Añadir links
|