Please do not get confused between the Diesel Engine Fuel Injectors and Petrol Engine Fuel Injectors as they are poles apart and run on different Combustion cycles altogether.
In a petrol engine, fuel injectors can be used in a numerous ways.
It can be used in the intake manifold before the Intake valve or
It can be used in the cylinder after the intake valve.
But Spark plugs are mandatory for a Petrol Engine, unlike Diesel Engines, where fuel gets ignited due to compressed air only.
In a petrol engine, the air is taken inside via the air filter, and a metered quantity of fuel is sprayed by the injectors as the air gushes in the cylinder via the intake valves. And an air-fuel mixture is formed which is later ignited by the spark plugs.
On the contrary, in a diesel engine, the fuel is injected inside the cylinder at the end of the compression stroke, and the fuel gets ignited resulting in the power stroke.
I have written this answer in a nutshell, but if you are really interested on how engines work, I recommend reading any book on Applied Thermodynamics. Your concepts will get clearer.