note 117407 added to class.dotnet
| From: | juan156_elias at gmail dot com | Date: | Thu, 04 Jun 2015 20:00:51 +0000 |
| Subject: | note 117407 added to class.dotnet | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-202749@lists.php.net to get a copy of this message | ||
Using COM and DOTNET directly is quite a nightmare. DOTNET only allows you to target .Net 3.5 and
below, and all the binaries need to be COM Visible. This basically means that you will need to
write your own .Net binaries for everything, at least wrappers.
There is a library out there (NetPhp) built on top of the COM class that will solve all these
issues, so you can get code like this:
$manager = new \NetPhp\Core\NetManager();
$manager->RegisterAssembly('mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089', 'mscorlib');
$manager->RegisterClass('mscorlib', 'System.IO.File', 'File');
$manager->RegisterClass('mscorlib', 'System.IO.FileOptions',
'FileOptions');
$file = $manager->Create('mscorlib', 'File');
$fileoptions = $manager->Create('mscorlib',
'System.IO.FileOptions')->Enum('Encrypted');
$file->Create("C:\\www\\prueba.tres", 2048, $fileoptions);
----
Server IP: 72.52.91.14
Probable Submitter: 177.242.51.176
----
Manual Page -- http://php.net/manual/en/class.dotnet.php
Edit -- https://master.php.net/note/edit/117407
Del: integrated -- https://master.php.net/note/delete/117407/integrated
Del: useless -- https://master.php.net/note/delete/117407/useless
Del: bad code -- https://master.php.net/note/delete/117407/bad+code
Del: spam -- https://master.php.net/note/delete/117407/spam
Del: non-english -- https://master.php.net/note/delete/117407/non-english
Del: in docs -- https://master.php.net/note/delete/117407/in+docs
Del: other reasons-- https://master.php.net/note/delete/117407
Reject -- https://master.php.net/note/reject/117407
Search -- https://master.php.net/manage/user-notes.php