Question: can a teacher take your phone?
Answer: Generally, they can't. Teachers have every right to seize your phone, but they have NO right to go through its contents unless you give them permission. It is illegal for a teacher to go through the private contents of your cellphone without your consent, and it is illegal for them to force you to do it yourself.