W
W
WayMax2018-08-09 10:36:41
PHP
WayMax, 2018-08-09 10:36:41

How to rewrite this ASP code in PHP?

There is an ASP project consisting of:
1. asax file

public class MyImage : System.Web.HttpApplication
{
    /* поля класса */

    protected void Application_Start(object sender, EventArgs e)
    {
        /* код */
    }
}

2.ashx file
public class GetImage : IHttpHandler
{
    public void ProcessRequest(HttpContext context)
    {
        /* код генерации изображения img*/

        context.Response.ContentType = "image/png";
        context.Response.BinaryWrite(img);
    }

    public bool IsReusable
    {
        get
        {
            return false;
        }
    }
}

When accessing GetImage.ashx, the web server returns the image. How to rewrite only ashx in PHP I understand
<?PHP
/* код генерации изображения img*/

header('Content-type: image/png');
imagepng($img);
imagedestroy($img);
?>

But I also need a part in asax. How to implement it in PHP?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman, 2018-08-09
@yarosroman

And it doesn't need to be rewritten. This is part of the initialization of an ASP application and is very dependent on the IIS server.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question