MapServer OGC:SLD Example

Input Mapfile
Mapscript code:
// load mapscript
dl("php_mapscript.dll");

// required SWIG include (contains constants for PHP7)
include("C:/ms4w/apps/phpmapscriptng-swig/include/mapscript.php");

// instantiate a new Map Object
// with the mapfile as an argument
$oMap = new mapObj("C:/ms4w/apps/ms-ogc-workshop/sld/demo.map");

// generate an SLD into a string variable
$sldString = $oMap->generatesld();

// print out the SLD
// or do whatever with it
echo $sldString;
					
Output OGC:SLD Document