2
私は現在、次のstrpos/striposを持っています(両方を試しても結果は変わりません)。フォーラムの投稿から特定の針を特定するために使用されます。strpos/stripos(厳密な比較)失敗
if (stripos($row->message, (string)$commit) !== false) {
// Do stuff
}
スタッフほとんどが正常に動作します、しかし、いくつかのケースでは干し草の山($行優先>メッセージ)針($コミット)が含まれ(キャストを使用して$コミットので、int型することができます)strpos/striposはfalseを返します。例えば
:
$test = stripos($row->message, (string)$commit);
非作業シナリオの例は次のとおりです。
// (string)$commit
string(7) "818df50"
// $row->message
string(321) "Intro. Crashes as soon as the main menu is shown. Graphics are horribly broken, no fixes have been found as of yet. [attachment=194] Build Used: Pull Request #3333 (0.0.3-5929) -> RPCS3-v0.0.3-2017-08-27-818f50b Side note: States it can display at 1080p, yet it is boxed in 1080p. However, it is fine in 720p."
// $test (strpos/stripos)
bool(false)
作業シナリオの例は次のとおりです。
// (string)$commit
string(7) "2570911"
// $row->message
string(219) "RPCS3 v0.0.3-3-2570911 Alpha The game doesn't even show its graphics window. [quote] ·F 0:00:34.138812 {PPU[0x1000000] Thread (main_thread) [0x0087c094]} MEM: Access violation writing location 0xcffff2d0 [/quote]" int(15) [2570911]
// $test (strpos/stripos)
int(15) [2570911]
私にはありません私が本当に明白な何かを見逃しているかどうかを知って、私は数回チェックし、アプローチは正しいようです。
注:この方法は数多くありますが、この特定のシナリオではこれらの文字列の比較が必要です。
ありがとうございます。
ああ、笑、もう少し寝る必要がある。それを何度か見て、そのような愚かなエラーに気付かなかった。ありがとう! – Ani