So, does the engine start and idle? Also, what kind of vehicle, and do you have pix? If it's just a bad knock sensor then you can get away with driving it gently back home. The knock sensor senses, wait for it, engine knock. Engine knock occurs when the fuel/air mixture ignites before it's supposed to, ie before the spark plug sparks. This can happen, and these days usually happens, because people are running low octane fuel. Low octane fuel only "makes" less power because the engine knock sensor will retard the timing electronically to reduce knock, which has the net effect of the engine producing less horsepower.
Point being if you put in the highest octane you can get and drive gingerly home you should be fine. Normally the engine is only knocking on hard acceleration because of the lean condition this usually causes, but can be caused by carbon build up. If you drive gently you should be fine. Listen for the "pinging" sound from the engine, this is the engine knocking and if you do that too long you can damage the engine.