ereg.php

PHPで正規表現を使う方法。

# php -f ereg.php 
<a href="phpinfo.ps.pdf">phpinfo.ps.pdf</a>

# cat ereg.php 
<?php
      $fileName = ‘phpinfo.ps.ps’;
      $downloadFileName = ereg_replace(‘\.ps$’, ‘.pdf’, $fileName);
      $downloadFile = ‘<a href="’ . $downloadFileName . ‘">’ . $downloadFileName . ”;
      echo $downloadFile;
?>

同じカテゴリの記事: Linux
同じカテゴリの記事: Program