The Yankees don’t even have to be on the field to get hurt.

Travis Hafner was hitting off a machine in the middle of last night’s 8-1 win over the Royals when he fouled a pitch off his left foot, ending his night.

“When I initially looked down, it didn’t look good,” Hafner said.

So he was relieved when X-rays came back negative and he was diagnosed with a bruise, meaning he could play today.

He wasn’t the only Yankee to leave prematurely.

Brett Gardner was hit by a pitch just above his right ankle in the sixth. Gardner played center in the top of the seventh, but was pulled after that — leading to utility infielder Alberto Gonzalez being inserted in right field.

“It’s all right,” said Gardner, who reached base all four plate appearances. He was hit twice, walked twice and scored a pair of runs. “I got hit pretty good. A day game [today] is kind of unfortunate. ... It might affect my running a little bit.”

Nevertheless, with Yankees continuing to go down at an alarming rate, the fact that neither player suffered a broken bone was almost surprising.

Hafner said that may be the last time he uses the batting machine.

“I probably won’t do it during the game,” Hafner said. “And I probably won’t hit off it anymore, either.”

The machine Hafner was using is nicknamed “The Humbler” because it’s so difficult to hit.

“I had it cranked up to 95-100 miles per hour,” Hafner said. “The ball moves all over the place. I just fouled the ball off. ... It’s kind of embarrassing.”