My iPhone 5 shut off and now flashes the apple logo when charged?

My iPhone 5 shut off and now flashes the apple logo when charged?

Added (1). My iPhone 5 started turning off on its own a couple days ago but would turn on when i would hold down the power button. But yesterday it turned off and wouldn't turn back on. When i plug it in to charge the apple logo shows like its turning on then the screen goes black a couple seconds later. It keeps doing this on and off thing with the apple logo i don't know what to do.

Restore it and if that doesn't work then send it to apple