A button to start php script, how?

前端 未结 5 2072
予麋鹿
予麋鹿 2020-12-30 05:31

I want to make a button that starts my php script after I click it. So do I just make 2 separate files and have action post to the php file and then let it start? or is ther

5条回答
  •  别那么骄傲
    2020-12-30 06:29

    I know this question is 5 years old, but for anybody wondering how to do this without re-rendering the main page. This solution uses the dart editor/scripting language.

    You could have an tag that contains a data attribute. Make the 1px by 1px and then use something like dart to dynamically change the 's data attribute which re-renders the data in the 1px by 1px object.

    HTML Script:

    
    
    
    
    
    
    
    

    someScript.php:

    
    

    dartScript.dart:

    import 'dart:html';
    
    InputElement button1;
    ObjectElement externalSource;
    
    void main() {
        button1 = querySelector('#button1')
            ..onClick.listen(runExternalSource);
    
        externalSource = querySelector('#external_source');
    }
    
    void runExternalSource(Event e) {
        externalSource.setAttribute('data', 'someScript.php');
    }
    

    So long as you aren't posting any information and you are just looking to run a script, this should work just fine.

    Just build the dart script using "pub Build(generate JS)" and then upload the package onto your server.

    提交回复
    热议问题