Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

PHP µ÷ÓÃ C# dll

ŪÁË°ëÌì, PHP ÖÕÓÚÄܵ÷ÓÃÎÒµÄC# dll ÁË.
¸ÃËÀµÄ,ÎÒ¶ÔC# COM×¢²áÒ»Ïò²»Á˽â, PHP ÎĵµÉÏÖ»¸øPHPÄDz¿·ÖÄÚÈÝ,û¸æËßÎÒÔõôŪdll
ÎÒ»¹ÉµÙâÙâµÄÓàRegsvr32 ×¢²áÄǸöc# dll.
±³¾°:
Windows xp sp3 ; apache 2.2.14 ; php 5.2.12 ;
VS2010 beta ;
ÓïÑÔ:
PHP5 , C#
C#²¿·Ö:
´´½¨Ò»¸ö C# Class Library . (dll)
´´½¨Íê³Éºó, ´ò¿ªÏîÄ¿µÄÊôÐÔ,
ÔÚµãÑ¡×ó±ßµÄ "Application"(¾ÍÊǵÚÒ»¸ötab) , È»ºóµã»÷ Assembly Information °´Å¥ , 
ÔÚµ¯³öµÄDialogÖÐ, ±ØÐëÔڵײ¿¹´ÉÏ: Make assembly COM-visible !
·ñÔò , Õâ¸ödll½«²»ÄÜÒÔCOM·½Ê½·ÃÎÊ .
( µ±È», ÄãÒ²¿ÉÒÔÔÚ´úÂëÖеÄÀàÉùÃ÷ÖÐдÉÏ[ComVisible(true)] , Ч¹ûÒ»Ñù)
´úÂëÈçÏÂ:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;  
namespace test
{   
    //[ComVisible(true)] //or check "Assembly COM-Visible" at Application-Assembly_Information dialog ;
    public class PhpImage
    {
        public string test()
        {
            return "Hello world!";
        }
    }
}
È»ºó±àÒë³öÁËdll , ÕâÀï½Ð phpimage.dll
ÎÒÒÔΪֱ½ÓÔÚphpÖÐдÈçÏÂÓï¾ä¼È¿É:
<?php 
  $myPhpImg = new COM("test.PhpImage"); 
  echo $myPhpImg ->test() ;
?>
ºóÀ´½á¹ûµ±È»ÊÇ´íÎóµÄ,ÎÞ·¨´´½¨com¶ÔÏó.
ÆäʵÓÃƨ¹ÉÏëÒ²ÖªµÀ, ϵͳÄÄÀïÖªµÀtest.PhpImageÊǶÔÓ¦ÄÄÒ»¸ödll !
¸ãÁË°ëÌì, ºóÀ´·¢ÏÖÒ»¸öÌû×Ó,ÒÀÑù»­ºù«:
http://hi.baidu.com/softways/blog/item/6c0755b515731dcb36d3cabf.html
ËûÊÇÒª:·¢²¼C# COM DLL
ÎÒÒ²²î²»¶à,ÎÒÖ»ÊÇÏëÖªµÀÔõôע²áC# µÄ COM DLL
ÎÒ¾ÍÔÙÖظ´Ò»±é°É:
¹Ø¼üÊÇ RegAsm.exe Õâ¸ö.net ¹¤¾ß³ÌÐò, Ïà¹Ø½éÉÜ:
http://msdn.microsoft.com/zh-cn/library/tzat5yw6(VS.80).aspx
Õâôע²áC# COM DLLµÄ :
(ps:ÎÒµÄdll½Ðphpimage.dll )
(ps2:ÇëÔÚphpimage.dllµÄÎļþ¼ÐÏÂ,µ÷ÓÃÕâ¸öÃüÁîÐÐ)
regasm phpimage.dll /tlb:phpimage.tlb /codebase
ok, Äã²»·ÅÐÄ¿ÉÒÔ²éÕÒregister, Äã»á·¢ÏÖÀïÃæÓÐÒ»¸ö test.PhpI


Ïà¹ØÎĵµ£º

php »ù´¡±Ê¼Ç operators

/***************************by
garcon1986********************************/
<?php
//php avancé 5 example
$a = 'hello';
$a .= 'world';
$table = 'users';
$id = 5;
$sql = 'SELECT * from'.$table. "WHERE ID = '$id'";
//date() GÏÔʾ24СʱµÄ¸ñʽ£¬iÏÔʾ·ÖÖÓ
echo 'il est'.date( ......

PHPÉÏ´«

/***************************by garcon1986**************************/
form.html
<html>
<head>
<title>Upload File</title>
</head>
<body>
<form enctype="multipart/form-data" method="POST" action="uploader.php">
<label> ......

php ¼¼ÊõÄÚĻѧϰ1

1. ´Óphp4 ¿ªÊ¼Ôö¼ÓÁ˱àÒ벿·Ö£¬php4½«ÔÚÔËÐÐÇ°¼ì²éÕû¸ö½Å±¾µÄÓï·¨£¬ÔÚ´Ë»ù´¡ÉϱàÒëËùÓеĺ¯Êý£¬²¢ÇÒÔËÐнű¾µÄÖ÷Òª²¿·Ö£¬Èç¹ûphp ³É¹¦´´½¨ÁËÖ¸¶¨µÄhtml,Ôò˵Ã÷½Å±¾Öв»´æÔÚ´íÎ󣬺¯Êý±àÒëÕýÈ·¡£ÒÑʵÏÖ±àÒëÒ»´Î£¬¶à´ÎÔËÐС£php4 ¿ªÊ¼Ê¹ÓÃ.php ΪÀ©Õ¹Ãû
2.php4 Ö§³Öcom,Óû§¿Éͨ¹ýº¯Êýcom,com_get,com_invoke,com_load,com_ ......

PHPÖеÄÅú´¦Àí£¨Ò»£©

ת×Ô£º http://www.phpsoho.com/article/php/200809/09-239.html
Èç¹û Web Ó¦ÓóÌÐòÖеÄÒ»¸öÌØÐÔÐèÒª³¬¹ý 1 Ãë»ò 2 Ãë²ÅÄÜÍê³É£¬ÄÇôӦ¸ÃÔõô°ì£¿ÐèҪijÖÖÀëÏß´¦Àí½â¾ö·½°¸¡£Ñ§Ï°¼¸ÖÖ¶Ô PHP Ó¦ÓóÌÐòÖг¤Ê±¼äÔËÐеÄ×÷Òµ½øÐÐÀëÏß·þÎñµÄ·½·¨¡£
´óÐ͵ÄÁ¬ËøµêÓÐÒ»¸ö´óÎÊÌ⡣ÿÌ죬ÔÚÿ¼ÒÉ̵ê»á·¢ÉúÊýǧ´Î½»Òס ......

php Ä£°åд·¨


<?php
/* @author: zhuyubing@gmail.com */
class Template{
        var $code;
        function Template($template){
            $this->code = implode('', @file($tem ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ