0

I have a client who is running OpenX (formerly PHPAdsNew), which is no longer being developed, and is not compatible with newer versions of PHP (as ereg and its variants are depreciated); the issue here is that I can't really tell what the ereg is supposed to be replacing to rewrite the line.

The old code is:

define ('phpAds_path', ereg_replace("[/\\\\]admin[/\\\\][^/\\\\]+$", '', __FILE__));

I would be very greatful for anyone's ideas!

4

1 回答 1

0

只需在正则表达式周围添加分隔符:

ereg_replace("[/\\\\]admin[/\\\\][^/\\\\]+$", '', __FILE__)

变成:

preg_replace("~[/\\\\]admin[/\\\\][^/\\\\]+$~", '', __FILE__)
//     here __^                  and here __^
于 2015-04-16T08:35:19.490 回答