Skip to content

Instantly share code, notes, and snippets.

@tufanbarisyildirim
Last active December 17, 2015 02:38
Show Gist options
  • Save tufanbarisyildirim/5536904 to your computer and use it in GitHub Desktop.
Save tufanbarisyildirim/5536904 to your computer and use it in GitHub Desktop.
php DOTNET sınıfına bir örnerk
<?php
/**
* Bu stringi GAC(Global Assembly Cache) 'ten oluşturmamız gerekiyor
* C:\Windows\assembly klasorunde sınıf bulunup Version, Culture ve PublicToken Alınmalı
* Bu klasörde yoksa ; dll buraya drag drop yontemiyle atılırsa register edilmiş olur
*
* @var mixed
*/
$gac_string = 'System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089';
$class_name = 'System.Windows.Forms.Form';
$form = new DOTNET($gac_string, $class_name);
// System.Windows.Forms.Form.Show metodunu cağırmış olduk. Windows sunucuda şuan bir form oluşmuş oldu
$form->Show();
while(true) {
//bu betik sonlanırsa com object de yok olacağından açık tuttum.
}
?>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Kefukar
{
public class Dotnet
{
public string getName() {
return "Savaş DOĞAN";
}
}
}
<?php
$gac_string = 'Kefukar';
$class_name = 'Kefukar.Dotnet';
$form = new DOTNET($gac_string, $class_name);
$name = $form->getName();
echo $name;
// Savaş Doğan
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment