How to change world background based on active camera?
This can be achieved using Drivers to feed an attribute of the Active Camera into the Environment material.

The current active camera can be determined using Python (as defined here) using :

obj_camera = bpy.context.scene.camera


We can distinguish between the different cameras by setting the Pass Index of each camera object to specific values - eg, 1, 2, 3.



In the Environment material, add a Value node, right-click the value field and select 'Add Driver'.

Ensure the Value node is selected and swap to a Graph Editor window and select Drivers. Highlight the newly added driver and open the properties panel with N. In the Drivers panel, set the Type to Scripted Expression and set Expr to 'bpy.context.scene.camera.pass_index'.



Note : You'll need to enable the File/Auto Execution/Auto Run Python Scripts option in the File/User Preferences settings if it isn't set already (this allows Blender to run Python code).

You should now find that as the Active Camera changes the value of the Value node in the Environment material changes to reflect that camera's Pass Index and this can be used to generate values (using Greater Than/Less Than maths nodes) to drive the Mix Shaders to select the desired material.  



Note : The displayed Value value for driven values doesn't always update immediately in the node tree - but the actual value used by the Environment material is correct (it has simply not been refreshed on-screen). Moving the mouse over the Value node should trigger the display to refresh.