PHP 오늘도 삽질

in #kr5 years ago (edited)

php 오늘도 삽질입니다.

get방식으로 숫자로 된 id를 넘겨 db에 있는 자료를 뿌리는 건데요.

id에 BOM이 묻어 나온 줄은 몰랐네요. 아니 BOM이라는 걸 오늘 처음 알았습니다.

그러니 아무리 id로 sql을 돌려도 sql이 먹지를 못하는게 당연하지요. 숫자 192가 넘어온 것이 아니라 [BOM코드]192가 넘어왔거든요. 숫자만 넘어오는게 아니라 앞에 이상한 스트링이 같이 붙어 넘어오는 겁니다.

이걸 또 없애보겠다고 또 삽질삽질했습니다. 도깨비풀처럼 잘 안 떨어지더군요.

notepad++에서 BOM없음으로 저장해봤다가 네이버 블로그에 BOM 제거기를 다운 받아서 돌려봤다가 별짓거리를 다해도 결국은 해결하지 못하고 자포자기 상태로 쓰러져 있다가 매우 쉬운 방법으로 해법을 찾았습니다.

substr($id,3);

묻어나온 BOM이 3바이트더군요. BOM을 그냥 면도칼로 잘랐습니다.

근데 신기한게 컴퓨터 껐다가 켜니 다시 BOM이 안 붙어 나옵니다. substr을 다시 지웠네요. 정말 헷갈리는 구만요~

Posted using Partiko Android


Sponsored ( Powered by dclick )

dclick-imagead

Sort:  

Thank you so much for being an awesome Partiko user! You have received a 0.43% upvote from us for your 40 Partiko Points! Together, let's change the world!

짱짱맨 호출에 응답하여 보팅하였습니다.

Thank you so much for being an awesome Partiko user! We have just given you a free upvote!

The more Partiko Points you have, the more likely you will get a free upvote from us! You can earn 30 Partiko Points for each post made using Partiko, and you can make 10 Points per comment.

One easy way to earn Partiko Point fast is to look at posts under the #introduceyourself tag and welcome new Steem users by commenting under their posts using Partiko!

If you have questions, don't feel hesitant to reach out to us by sending us a Partiko Message, or leaving a comment under our post!

Congratulations @songbj! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You made more than 6000 upvotes. Your next target is to reach 7000 upvotes.

Click here to view your Board
If you no longer want to receive notifications, reply to this comment with the word STOP

Support SteemitBoard's project! Vote for its witness and get one more award!

Coin Marketplace

STEEM 0.32
TRX 0.11
JST 0.034
BTC 66785.29
ETH 3229.75
USDT 1.00
SBD 4.30