-2

デフォルトのコードを実行する方法はありますか。これを説明する方法はわかりませんが、最善を尽くします。

<?php
if ($test == "CODE-*AnyWordHere*"){
    echo "Yes";
}
?>

もう一つの例:

<?php
if ($url == "http://stackoverflow.com/secretplace/index.html/?*AnyWordHere*"){
    echo "Yes";
}
?>
4

3 に答える 3

0

strpos()または次を使用できます。

function strending($string, $keyword){
    return substr($string, strlen($string)-strlen($keyword), strlen($string)) == $keyword;
}

strending("hello world", "world"); //true
strending("hello world!", "world"); //false

これがあなたの言いたいことかどうかわかりません。を使ってみることもできますregexp

于 2012-08-05T01:36:54.013 に答える
0

私があなたの質問を正しく理解していれば、文字列に次のような別の文字列が含まれているかどうかを確認するために一致するstrstrを探しています。

<?php
    $email  = 'http://stackoverflow.com/secretplace/index.html/?someTerm';
    $domain = strstr($email, 'someTerm');
    if ($domain)
    {
        // Your 'someTerm' was found in the string.
    }
?>
于 2012-08-05T01:32:58.840 に答える