Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Raeen committed Jan 23, 2021
1 parent 7c854aa commit f754eb9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 26 deletions.
23 changes: 9 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ python = 3.9.1
numpy = 1.19.3
python-opencv = 4.4.0.46
```

***

**Python**

We use these libraries for create phpy.py:
Expand Down Expand Up @@ -115,19 +118,11 @@ $data1 = [
$data2 = "test";
$output = $python->gen("../Python/test2.py", $data1, $data2);
```
***
**Show result**

```php
$output = $python->gen(path,datas...)
```

In $output you have python result also you can ```gen_line()``` function for return last line of result

Also you can use ```gen_live_show()``` for print live output

Example:


```php
$site = "google.com";
$python->gen_live_show(
Expand All @@ -139,16 +134,16 @@ $python->gen_live_show(
return "<pre>$res</pre>";
}
);

```
If result is json , you should use this
***
**Show result**

```php
$python->dump($json_data,$pre_tag)
$output = $python->gen(path,datas...)
```
This function for json decoding

If $pre_tag is true , show result in pre tag
In $output you have python result also you can ```gen_line()``` function for return last line of result

***
**Show Img**

Expand Down
11 changes: 0 additions & 11 deletions core/Python.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,6 @@ public function img(string $output, string $type, bool $show = false, array $sty
}
return "data:image/" . $type . ";base64," . $res;
}
public function dump($data, bool $pre_tag = true)
{
$output = json_decode($data);
if ($pre_tag) {
echo "<pre>";
var_dump($output);
echo "</pre>";
} else {
var_dump($output);
}
}
public function path($dir, $path)
{
$local_path = explode('/', $path);
Expand Down
2 changes: 1 addition & 1 deletion php/test2.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
];
$data2 = "test";
$output = $python->gen("../Python/test2.py", $data1, $data2);
$python->dump($output);
var_dump($output);

0 comments on commit f754eb9

Please sign in to comment.