public function testPhone() { $result = SimpleValidator::phone("157-57125300"); $this->assertEquals(true, $result); $result = SimpleValidator::phone("0571-5712530"); $this->assertEquals(true, $result); $result = SimpleValidator::phone("010-1234567"); $this->assertEquals(true, $result); $result = SimpleValidator::phone("021-12345678"); $this->assertEquals(true, $result); //手机号 $result = SimpleValidator::phone("15757125300"); $this->assertEquals(false, $result); $result = SimpleValidator::phone("15757-125301"); $this->assertEquals(false, $result); $result = SimpleValidator::phone("1575-7125301111"); $this->assertEquals(false, $result); }