Depends what type of school you are in
Primary? hell no
Middle / high? depends on the age of the students and connection between them and the teachers really.
University / college? sure why not. Most students are mature enough and not everything has to be so strict / up tight.
BUT! Story time kids, listen up.
As a teacher. DO. NOT. SHARE. your personal cell phone number. We got email to contact you.
A female teacher (the attractive kind) shared it with her classes (all of em). You guys wanna guess who got, slightly intoxicated, texts asking her out. Yep that teacher. No not by me though, just to nip that in the but.
She won't be doing that anymore.
Quick edit:
Since names / ages in school differ from each other around the world, here is a quick rundown.
Primary = until 12 y/o (give or take, unless they have to do a do over year, or w/e)
Middle / high= until 16/18 (give or take, one could need more years)
University / college= until 20/22 (taking a 4 year average here, but you know, give or take)